1
votes

I'm struggling with setting up Durandal to run under an IIS virtual folder, when using PushState :true in the router config.

Works fine when running through say http://localhost:24567

But if I run under http://localhost/testapp (testapp is the virtual folder), the routes don't work, and the route links are being rendered without the virtual folder "testapp"

Is there a way to set a base url either using require.js config or via Durandal router?

Thanks

1

1 Answers

3
votes

Ok, feeling a little stupid and should have RTFM!

There is a root option when activating the router, especially for when using push-state.

http://durandaljs.com/documentation/Using-The-Router.html

        router.map([
            { route: '', title:'Welcome', moduleId: 'viewmodels/welcome', nav: true },
            { route: 'flickr', moduleId: 'viewmodels/flickr', nav: true }
        ]).buildNavigationModel();

        return router.activate({ pushState : true ,root:'/MvcApplication1'});

Moral of the story, read the manual more carefully.

Thanks to Yago who has authored a fantastic demo app for Durandal that includes membership/client side authorisation as well as oauth logins, Durandal Auth