server/routes.ts

14 lines
437 B
TypeScript
Raw Permalink Normal View History

import { FileSystemRouter } from "bun";
// Returns the route filesystem path when given a URL
export const routeMatcher = new FileSystemRouter({
2024-04-07 07:30:49 +02:00
style: "nextjs",
dir: "api",
fileExtensions: [".ts", ".js"],
});
export const routes = Object.fromEntries(
Object.entries(routeMatcher.routes)
.filter(([route]) => !route.endsWith(".test"))
.map(([route, path]) => [route, path]),
) as Record<string, string>;