working
This commit is contained in:
17
src/routes/api/domain_issued/+server.ts
Normal file
17
src/routes/api/domain_issued/+server.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { error, json } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from "./$types";
|
||||
|
||||
import { client_promise } from "$lib/mongo";
|
||||
import { is_domain_already_issued } from "$lib/db";
|
||||
|
||||
export const GET: RequestHandler = async ({ url }) => {
|
||||
const domain = url.searchParams.get("domain");
|
||||
if (!domain) {
|
||||
return error(400, "Missing URL query param `domain`");
|
||||
}
|
||||
let db = await client_promise;
|
||||
return json({
|
||||
issued: await is_domain_already_issued(db, domain),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user