From be0f537dc4fe384eef09436833c6407e6482c16d Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 9 Nov 2023 15:40:16 +0700 Subject: Initial commit --- src/app/api/hash/route.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/app/api/hash/route.tsx (limited to 'src/app/api/hash') diff --git a/src/app/api/hash/route.tsx b/src/app/api/hash/route.tsx new file mode 100644 index 0000000..2727e1f --- /dev/null +++ b/src/app/api/hash/route.tsx @@ -0,0 +1,10 @@ +import { NextRequest, NextResponse } from "next/server"; +import bcrypt from "bcrypt" + +export async function GET(request: NextRequest) { + const searchParams = request.nextUrl.searchParams; + const password = searchParams.get('password') ?? ''; + const hash = await bcrypt.hash(password, 10); + + return NextResponse.json({ hash }); +} \ No newline at end of file -- cgit v1.2.3