Skip to content

Commit

Permalink
Update page_handler.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Mqxx committed Oct 17, 2024
1 parent 3e6db6c commit e6a970f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/server/request_handler/page_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ import { serveFile } from '@std/http/file-server';
* This function handles page requests.
*
* @param request The request from the client
* @param root The root directory
* @param page The requested page
* @param defaultFile The default file to serve
* @param file The file to serve
* @returns The page response
*/
export default function pageHandler(
request : Request,
root : string,
page : string | undefined,
defaultFile = 'index.html'
file : string = 'index.html'
) : Promise<Response> {
return serveFile(
request,
`./dist/route/${page}/${defaultFile}`
`${root}/${page}/${file}`
)
}

0 comments on commit e6a970f

Please sign in to comment.