import { db } from '@/lib/db' import { hash } from 'bcrypt' import { NextResponse } from 'next/server' export async function POST(req: Request) { try { const { username, email, password } = await req.json() const hashed = await hash(password, 12) const user = await db.user.create({ data: { username, email, password: hashed } }) return NextResponse.json({ username: user.username, email: user.email }) } catch (err: any) { return new NextResponse(JSON.stringify({ error: err.message }), { status: 500 } ) } }