2024-04-16 09:13:34 +02:00
|
|
|
import { join } from "node:path";
|
2023-12-08 09:25:31 +01:00
|
|
|
// Returns the route filesystem path when given a URL
|
|
|
|
|
export const routeMatcher = new Bun.FileSystemRouter({
|
2024-04-07 07:30:49 +02:00
|
|
|
style: "nextjs",
|
2024-08-27 16:37:23 +02:00
|
|
|
dir: `${process.cwd()}/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-03-29 03:30:06 +01:00
|
|
|
.map(([route, path]) => [
|
|
|
|
|
route,
|
|
|
|
|
path.replace(join(process.cwd()), "."),
|
|
|
|
|
]),
|
2024-10-03 13:26:00 +02:00
|
|
|
) as Record<string, string>;
|