Files
sistem-desa-mandiri/src/module/village/api/api_village.ts
amel 796c3227f0 upd: respon api
Deskripsi:
- update respon api pada village

No Issues
2024-07-29 12:19:01 +08:00

16 lines
522 B
TypeScript

import { API_INDEX_VILLAGE } from "./api_index";
type Method = "GET" | "POST";
export async function apiViilage(req: Request, method: Method) {
const { searchParams } = new URL(req.url);
const path = searchParams.get("path");
const act = API_INDEX_VILLAGE.find(
(v) => v.path === path && v.method === method
);
if (!path)
return Response.json({ success: false, message: "page not found" }, { status: 404 });
if (act) return act.bin(req);
return Response.json({ success: false, message: "404" });
}