More logging

This commit is contained in:
Jesse Wierzbinski 2024-04-14 01:52:50 -10:00
parent da09d10e9a
commit e575075006
No known key found for this signature in database
2 changed files with 9 additions and 6 deletions

View file

@ -101,9 +101,8 @@ export const routeMatcher = new Bun.FileSystemRouter({
export const matchRoute = async (url: string) => { export const matchRoute = async (url: string) => {
const route = routeMatcher.match(url); const route = routeMatcher.match(url);
if (!route) return { file: null, matchedRoute: null };
return { console.log(route);
matchedRoute: route,
}; return route ?? null;
}; };

View file

@ -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 // 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"), 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); return await processRoute(matchedRoute, req, logger);
} }