Nerds Publishing Monstrosities
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    routepublic

    route

    Basic routing:

    function foo(year, month, day, id) {
        // ...
    };
    
    function bar(first, middle, last) {
        // ...
    };
    
    function baz(optional) {
        // ...
    };
    
    $.route.add({
        'foo/:year/:month/:day/:id': foo,  // Regular arguments capture a single path part
        'bar/:first/*middle/:middle': bar  // Splat arguments capture any number of path parts
        'baz[/:optional]': baz  		   // Brackets indicate optional path components
    });
    
    $.route.run(document.location.pathname);
    

    Usage with Ender

    After you install Ender, include route in your package:

    ender add route
    

    install

    npm i route

    Downloadsweekly downloads

    242

    version

    0.2.5

    license

    none

    last publish

    collaborators

    • avatar