A li'l app router for the browser
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dist
lib
test
.gitignore
.npmignore
LICENSE
README.md
grunt.js
package.json

README.md

lilrouter

A li'l router for your browser

Usage

load dist/lilrouter.js or dist/lilrouter.min.js in your browser and call it like this:

(function () {

  var lilRouter = require('lilrouter');

  var router = lilRouter.create({

    init: function (router) {
      //called on page load  
      var session = { userId: '1231l2jl12' }
      return session;
    },
    get: {
      '/': function (context, router) {
        //context.session.userId = '1231l2jl12'
      }
    },
    post: {
      '/beer/:beerId/edit': function (context, router) {
        //context.session.userId = '1231l2jl12'
        //context.params.beerId = '123lkj'
        //context.body.name = 'pils'
      }
    }

  });

  router.get('/');
  router.post('/beer/123lkj/edit', { name: 'pils' });


}());

License

Copyright (c) 2012 August Hovland Licensed under the MIT license.