Is it possible to change the static resource file based on the URL query? Here is an example of my folder structure:
/root
-> server.ts
-> /projects
-> libraries used in index.html files
-> /project1
-> index.html
-> files used in index.html
-> /project2
-> index.html
-> files used in index.html
This is how static files are handled in Deno using the Oak library:
app.use(async (ctx, next) => {
await send(ctx, ctx.request.url.pathname, {
root: `${Deno.cwd()}/static`,
})
next()
});
The goal is to display the corresponding index.html file for a specific project ID when accessing a URL like mydomain.com/project/project1.
Currently, the Oak router is used to redirect URLs in this manner:
const router = new Router();
router.get('/project/:project_id', project)
export const project = async (ctx: RouterContext) => {
ctx.render(`${Deno.cwd()}/projects/` + ctx.params.projectid + '/index.html');
}
Thank you for any assistance provided.