diff --git a/routes.ts b/routes.ts index c8b8b47d..ca3b5fcb 100644 --- a/routes.ts +++ b/routes.ts @@ -101,9 +101,8 @@ export const routeMatcher = new Bun.FileSystemRouter({ export const matchRoute = async (url: string) => { const route = routeMatcher.match(url); - if (!route) return { file: null, matchedRoute: null }; - return { - matchedRoute: route, - }; + console.log(route); + + return route ?? null; }; diff --git a/server.ts b/server.ts index 553fb37d..6874c73f 100644 --- a/server.ts +++ b/server.ts @@ -116,11 +116,15 @@ export const createServer = ( } // If route is .well-known, remove dot because the filesystem router can't handle dots for some reason - const { matchedRoute } = await matchRoute( + const matchedRoute = await matchRoute( req.url.replace(".well-known", "well-known"), ); - if (matchedRoute && matchedRoute.name !== "/[...404]") { + if ( + matchedRoute && + Object.keys(matchedRoute).length !== 0 && + matchedRoute.name !== "/[...404]" + ) { return await processRoute(matchedRoute, req, logger); }