gabrielmoreira / riot-router

Riot Router - A simple routing solution for Riot
MIT License
77 stars 14 forks source link

html5 mode? #12

Open syropian opened 8 years ago

syropian commented 8 years ago

Is there a way to omit the # prefix for routes, so I can link to myapp.dev/foo instead of myapp.dev/#/foo?

gabrielmoreira commented 8 years ago

@syropian, i don't know.

You can try route.base('/app') https://github.com/riot/route/tree/master/doc#routebasebase

There are some issues on Riot for supporting it: https://github.com/riot/riot/issues/685 Needs pushState (IE10+ http://caniuse.com/#search=pushstate)

syropian commented 8 years ago

@gabrielmoreira

Sorry I'm a little confused at the moment. Am hoping you could clear a few things up.

1) Does this extend Riot's built-in router? (http://riotjs.com/api/route/) 2) Is riot/route (https://github.com/riot/route) a totally separate module to use in place of Riot's built-in router? Or is it simply a standalone version of what's built in to the Riot library? 3) If riot/route is completely separate is this compatible with it?

I only ask as I don't see anything about being able to use route.base() in http://riotjs.com/api/route/, only in riot/route. I attempted to pull in riot/route and set route.base('/') but your router is still only picking up on changes that have # in the url.

danhper commented 8 years ago

@syropian Hi,

  1. This is a router inspired by react-router built on top of Riot built-in router.
  2. riot/route IS riot router. To improve modularity, the development of riot has been split into multiple repositories and modules.

The addition of route.base is recent and will probably be available from Riot 2.3 (current is 2.2) which is why it is not yet in the docs.

So if you are not too much in a hurry, your best bet is to try this module with route.base when Riot 2.3 is out. AFAIK as I know it should work without any changes, but reply here or open a new issue if it does not.