feat: add registration endpoint
This commit is contained in:
23
app/api/register/route.ts
Normal file
23
app/api/register/route.ts
Normal 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 });
|
||||
}
|
||||
Reference in New Issue
Block a user