refactor: remove some duplicated code
This commit is contained in:
@ -1,11 +1,10 @@
|
||||
import { HandlerContext } from "$fresh/server.ts";
|
||||
import { Handlers } from "$fresh/server.ts";
|
||||
import { getDocuments } from "@lib/documents.ts";
|
||||
import { json } from "@lib/helpers.ts";
|
||||
|
||||
export const handler = async (
|
||||
_req: Request,
|
||||
_ctx: HandlerContext,
|
||||
): Promise<Response> => {
|
||||
const documents = await getDocuments();
|
||||
const response = new Response(JSON.stringify(documents));
|
||||
return response;
|
||||
export const handler: Handlers = {
|
||||
async GET() {
|
||||
const documents = await getDocuments();
|
||||
return json(documents);
|
||||
},
|
||||
};
|
||||
|
Reference in New Issue
Block a user