15 lines
381 B
TypeScript
15 lines
381 B
TypeScript
import { json_response } from "utils";
|
|
import { get_db_obj } from "db";
|
|
|
|
export async function handler(req: Request): Promise<Response> {
|
|
if (req.method == "GET") {
|
|
return await get();
|
|
} else {
|
|
return new Response(JSON.stringify({ err: "expected a GET" }));
|
|
}
|
|
}
|
|
|
|
async function get(): Promise<Response> {
|
|
return json_response(await get_db_obj());
|
|
}
|