Using Oak
, how can I serve HTML without the extension? e.g.
host:port/home.html
-> host:port/home
Here's my current code to render my public/views
folder:
router.get('/:page', async (ctx: Context, next: () => Promise<unknown>) => {
await send(ctx, ctx.request.url.pathname, {
root: join(Deno.cwd(), 'public', 'views'),
extensions: ['htm', 'html']
});
await next();
});
The extensions
option is not working or maybe I just use it the wrong way.
Edit
My fix is currently removing the .html
extension (e.g. home.html
-> home
). Pretty sure there's a better way than this