Hello everyone.
I'm familiarizing myself with vibe.d, but I encountered - I assume - a small problem regarding serving static files while having nested URL routers.
Here's a theoretical situation:
URLRouter getAssembledURLRouter()
{
URLRouter router = new URLRouter();
URLRouter sub_router = getSubRouter();
router.get("/", &indexResource);
router.any("*", sub_router); // Append the nested router.
router.get("*", serveStaticFiles("static/"));
return router;
}
URLRouter getSubRouter()
{
URLRouter sub_router = new URLRouter("/nested");
sub_router.get("/", &someResource);
sub_router.get("/blah", &someBlahResource);
return sub_router;
}
The problem
Let's assume we have a style.css
file. While accessing /
the file is served a-ok. But when I access /nested
or /nested/blah
the file is tried to be served with path /nested/style.css
which of course results in 404.
Question
How do I force vibe.d to always serve static files on path /
while having nested routers structure as shown above?
Cheers! :)