diff options
author | polwex <polwex@sortug.com> | 2025-05-15 10:13:00 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-05-15 10:13:00 +0700 |
commit | d56594d3289002566f4653d607f0837befd65109 (patch) | |
tree | f69685b458419566a78727ce6a8cecd0cdc269a5 /src/pages/api/auth.ts | |
parent | 04509d9207603d9055cf022051763ec05c9214d6 (diff) |
wtf man
Diffstat (limited to 'src/pages/api/auth.ts')
-rw-r--r-- | src/pages/api/auth.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/pages/api/auth.ts b/src/pages/api/auth.ts new file mode 100644 index 0000000..3ed9b76 --- /dev/null +++ b/src/pages/api/auth.ts @@ -0,0 +1,17 @@ +import db from "../../lib/db"; +export const POST = async (request: Request): Promise<Response> => { + const body = await request.json(); + + if (!body.name || !body.creds) { + return Response.json({ message: "Invalid" }, { status: 400 }); + } + + try { + const res = db.loginUser(body.name, body.creds); + console.log({ res }); + + return Response.json(res, { status: 200 }); + } catch (error) { + return Response.json({ message: "Failure" }, { status: 500 }); + } +}; |