freshter-logs/routes/api/db/index.ts

15 lines
381 B
TypeScript
Raw Permalink Normal View History

2023-04-28 19:48:34 -04:00
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());
}