feat: add registration endpoint

This commit is contained in:
Riccardo
2024-06-26 12:40:01 +02:00
parent 62f75a2b96
commit 6fab8e6fb8

23
app/api/register/route.ts Normal file
View File

@@ -0,0 +1,23 @@
import prisma from '@prisma/prisma';
import { NextRequest, NextResponse } from 'next/server';
export async function POST(request: NextRequest) {
const { email } = await request.json();
if (email) {
await prisma.user.upsert({
create: {
email
},
update: {
updatedAt: new Date()
},
where: {
deleted: false,
email
}
});
}
return NextResponse.json({ message: email });
}