2025-03-30 23:06:34 +02:00
|
|
|
import { FileSystemRouter } from "bun";
|
2023-12-08 09:25:31 +01:00
|
|
|
// Returns the route filesystem path when given a URL
|
2025-03-30 23:06:34 +02:00
|
|
|
export const routeMatcher = new FileSystemRouter({
|
2024-04-07 07:30:49 +02:00
|
|
|
style: "nextjs",
|
2025-04-14 17:30:01 +02:00
|
|
|
dir: "api",
|
2024-04-16 09:13:34 +02:00
|
|
|
fileExtensions: [".ts", ".js"],
|
2023-12-08 09:25:31 +01:00
|
|
|
});
|
|
|
|
|
|
2024-10-03 13:26:00 +02:00
|
|
|
export const routes = Object.fromEntries(
|
|
|
|
|
Object.entries(routeMatcher.routes)
|
|
|
|
|
.filter(([route]) => !route.endsWith(".test"))
|
2025-04-14 17:30:01 +02:00
|
|
|
.map(([route, path]) => [route, path]),
|
2024-10-03 13:26:00 +02:00
|
|
|
) as Record<string, string>;
|