File Router
File System Router A`la Nextjs.
Usage
// routes/index.ts
import { RequestEvent } from "@nhttp/nhttp";
export function GET(rev: RequestEvent) {
return "Hello, Home Index";
}
// app.ts
import nhttp from "@nhttp/nhttp";
import { generateRoute } from "@nhttp/nhttp/file-router";
const app = nhttp();
await generateRoute(app, "routes", (file) => import("./" + file));
app.listen(8000);
Lookup route from dir
import { getRouteFromDir } from "@nhttp/nhttp/file-router";
const route = await getRouteFromDir("my_dir");
console.log(route);