freshter-logs/routes/api/db/index.ts
2023-04-28 19:48:34 -04:00

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());
}