Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Mqxx committed Nov 5, 2024
1 parent 308899c commit becbcec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ const routes: Route[] = [
parameters?.pathname.groups.staticAsset
)
},
{
pattern: new URLPattern({ pathname: '/:page([^\.]*)' }),
handler: (request, _info, parameters) => {
console.log('page', parameters?.pathname.groups.page);

return pageHandler(request, appDirectory, '')
}
},
{
pattern: new URLPattern({ pathname: '/:asset' }),
handler: (request, _info, parameters) => {
Expand All @@ -26,14 +34,6 @@ const routes: Route[] = [
);
}
},
{
pattern: new URLPattern({ pathname: '/:page([^\.]*)' }),
handler: (request, _info, parameters) => {
console.log('page', parameters?.pathname.groups.page);

return pageHandler(request, appDirectory, '')
}
}
];

Deno.serve(
Expand Down
2 changes: 0 additions & 2 deletions src/server/request_handler/page_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export default function pageHandler(
page : string | undefined,
file : string = 'index.html'
) : Promise<Response> {
console.log('Serving:', `${root}/${page ?? ''}/${file}`);

return serveFile(
request,
`${root}/${page ?? ''}/${file}`
Expand Down

0 comments on commit becbcec

Please sign in to comment.