Narcoleptic Programmers' Medicine
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

conduttore

0.1.1 • Public • Published

Conduttore Build Status

Features

  • Fast, very fast!!
  • Multipurpose
    • Environment agnostic - isomorphic implementation
    • Purpose agnostic (i.e. not just for URLs routing)
  • Automatic route parameters retrieval and type coercion

Installation

Using NPM with: npm install git://github.com/cesarenaldi/conduttore.git

Using bower.js: bower install git://github.com/cesarenaldi/conduttore.git

Example

var conduttore = require('conduttore')
 
function handler (controller, action, type)
 
var router = conduttore({
    aliases: {
        ':controller': ':text',
        ':action': ':text'
    },
 
    params: {
        ':type': ['topolino', 'pluto']
    },
 
    routes: [
        { '/:controller/:action/:type': handler},
        { '*': defaultHandler }
    ]
})
 
// retrieve the route value (a function in this case)
router.resolve('/users/edit/topolino')
 
// or invoke the route handler
router
    .dispatch('/users/edit/topolino')
    .then(function (handlerResult) {
        // your post processing logic goes here
    })
 

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

(Nothing yet)

License

Copyright (c) 2014 Cesare Naldi
Licensed under the MIT license.

install

npm i conduttore

Downloadsweekly downloads

7

version

0.1.1

license

BSD

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar