RejectedSoftware Forums

Sign up

serveStaticFiles problem

Hi,

im playing with vibe.d and i really like it.

I have a problem with this :

auto router = new URLRouter();
router
    .get("/", &showHome)
    .get("/home", &showHome)
    .get("/home/test", &showHome);

router.get("*", serveStaticFiles("./application/public/"));

I can load css/js files when i use "http://127.0.0.1/home" but it fails when i try with "http://127.0.0.1/home/test" (its trying to load /home/css/...").

do you know how I can solve this problem ? thanks.

Re: serveStaticFiles problem

On Tue, 17 Dec 2013 15:01:32 GMT, Misu wrote:

Hi,

im playing with vibe.d and i really like it.

I have a problem with this :

auto router = new URLRouter();
router
    .get("/", &showHome)
    .get("/home", &showHome)
    .get("/home/test", &showHome);

router.get("*", serveStaticFiles("./application/public/"));

I can load css/js files when i use "http://127.0.0.1/home" but it fails when i try with "http://127.0.0.1/home/test" (its trying to load /home/css/...").

do you know how I can solve this problem ? thanks.

It's working with :

link(rel="stylesheet", href="#{req.rootDir}css/mycss.css")

I found it there : https://github.com/rejectedsoftware/vibenews/blob/master/views/layout.dt
I should have searched before asking. Sorry.

Thanks.