api : add api
Deskripsi: - add gorup - add position - village No issue
This commit is contained in:
15
src/module/village/api/api_village.ts
Normal file
15
src/module/village/api/api_village.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
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({ message: "page not found" }, { status: 404 });
|
||||
if (act) return act.bin(req);
|
||||
|
||||
return Response.json({ message: "404" });
|
||||
}
|
||||
Reference in New Issue
Block a user