My name is Vasyl Khrystiuk‎ > ‎pub‎ > ‎JavaScript‎ > ‎

routing library

Tags: javascript_tag

I started my last project in horror manner. I did all as simple as possible - so far a has a lot of inline JS in my HTML.
Now i need to remove this. But I do not want to rewrite my scripts significant. 
Also project is pretty big now and i need some thing to make JS writting simpler. For solving this tasks I need some JS-routing library.
There are a lot of such.
Fast googling bring me here: http://stackoverflow.com/questions/6315505 
Same as asker, i do not want Backbone.js, as far as I have alreay implementation in other framework(jQuery). So there are given these variants:

I even do not know, which one to use, thay look from here identically. 
So i select first one - 
pathjs.

Upd: a i do not know how to use reqexp in url rputes so i switched to crossroads
TODO: add this route to Path: "/lol/:anystring(/:anything)"

More here:

Simple usage:
crossroads.addRoute("/proposal/:proposalid:/:any*:", function(proposalid){
    alert(proposalid);      
});
crossroads.parse(document.location.pathname);




Comments