server/routes.ts
Jesse Wierzbinski 1679585c4c
Some checks failed
CodeQL Scan / Analyze (javascript-typescript) (push) Failing after 4s
Build Docker Images / lint (push) Failing after 10s
Build Docker Images / check (push) Failing after 10s
Build Docker Images / tests (push) Failing after 6s
Deploy Docs to GitHub Pages / build (push) Failing after 0s
Build Docker Images / build (server, Dockerfile, ${{ github.repository_owner }}/server) (push) Has been skipped
Build Docker Images / build (worker, Worker.Dockerfile, ${{ github.repository_owner }}/worker) (push) Has been skipped
Deploy Docs to GitHub Pages / Deploy (push) Has been skipped
Mirror to Codeberg / Mirror (push) Failing after 0s
Nix Build / check (push) Failing after 0s
fix: 🚨 Enable more Biome 2.0 rules
2025-04-10 19:56:42 +02:00

16 lines
542 B
TypeScript

import { join } from "node:path";
import { cwd } from "node:process";
import { FileSystemRouter } from "bun";
// Returns the route filesystem path when given a URL
export const routeMatcher = new FileSystemRouter({
style: "nextjs",
dir: `${cwd()}/api`,
fileExtensions: [".ts", ".js"],
});
export const routes = Object.fromEntries(
Object.entries(routeMatcher.routes)
.filter(([route]) => !route.endsWith(".test"))
.map(([route, path]) => [route, path.replace(join(cwd()), ".")]),
) as Record<string, string>;