From e5750750068b18efa7ecfbb8a8467306e49eb1f4 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Sun, 14 Apr 2024 01:52:50 -1000 Subject: [PATCH] More logging --- routes.ts | 7 +++---- server.ts | 8 ++++++-- 2 files changed, 9 insertions(+), 6 deletions(-) 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); }