1.2.7 • Published 10 years ago

pipeline-router v1.2.7

Weekly downloads
4
License
MIT
Repository
github
Last release
10 years ago

router

Node.js module for simplifying http routing for your server without having to sign up for the accompanying framework.

This project strives to be a straight forward routing solution for common http applications where you need to parse urls and then activate some chain of logic. Many other options either come with a much bigger framework or are trying to solve a bigger problem (like client side routing).

This routing module is targeted for speed hungry people that want to be closer to the metal. If you are not that type of person, then use express.js.

browser support

travis-ci status

Install

npm install pipeline-router

Example

This example is in the tests folder. Here is a simple http router.

var http = require('http'),
	Router = require('pipeline-router');

var routerFactory = {
	create: function() {
		var router = new Router();

		router.param('zip', /zip-(\d{5})/);
		router.param('item', /(\w*)/);

		router.get('/foo/:zip/:item', function(req, res) {
			res.writeHead(200, { 'Content-Type': 'application/json' });
	        res.write(JSON.stringify(req.params));
	        res.end();
		});

		router.get('/', function(req, res) {
			res.write("Home");
			res.end();
		});

		return router;
	}
};

var server = http.createServer(function (req, res) {
	var router = routerFactory.create();

	router.dispatch(req, res);

});

server.listen(3000);
1.2.7

10 years ago

1.2.6

11 years ago

1.2.5

11 years ago

1.2.4

11 years ago

1.2.3

11 years ago

1.2.2

11 years ago

1.2.1

11 years ago

1.2.0

11 years ago

1.1.8

11 years ago

1.1.7

11 years ago

1.1.6

11 years ago

1.1.5

11 years ago

1.1.4

11 years ago

1.1.3

11 years ago

1.1.2

11 years ago

1.1.1

11 years ago

1.1.0

11 years ago

1.0.4

11 years ago

1.0.3

11 years ago

1.0.2

12 years ago

1.0.1

12 years ago

1.0.0

12 years ago

0.8.0

12 years ago

0.7.0

12 years ago

0.6.0

12 years ago

0.5.7

12 years ago

0.5.6

12 years ago

0.5.5

12 years ago

0.5.4

12 years ago

0.5.3

12 years ago

0.5.2

12 years ago