conduttore
A multi-purpose Router
Last updated 6 years ago by cnaldi .
BSD · Repository · Original npm · Tarball · package.json
$ cnpm install conduttore 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 0.1.3                                ...           0.1.3 (6 years ago)
  • 0.1.1                                ...           latest (6 years ago)

2 Versions

  • 0.1.3                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 3
Dependencies (5)
Dev Dependencies (26)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |