regex-router
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -8,6 +8,5 @@ 'use strict'; /*jslint node: true, indent: 2, es5: true*/ | ||
Router.prototype.route = function(req, res) { | ||
var route; | ||
var m; | ||
for (var i = 0, l = this.routes.length; i < l; i++) { | ||
route = this.routes[i]; | ||
var route = this.routes[i]; | ||
if (route.http_method === undefined || route.http_method === req.method.toLowerCase()) { | ||
@@ -14,0 +13,0 @@ m = req.url.match(route.regex); |
{ | ||
"name": "regex-router", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Route http requests via regular expressions.", | ||
@@ -18,3 +18,4 @@ "keywords": [ | ||
"main": "./index.js", | ||
"license": "MIT", | ||
"author": "Christopher Brown <io@henrian.com>" | ||
} |
# Regex-router | ||
Regex-router is a simple Node.js library to simplify routing. And by simplify, I mean 39 lines of code. | ||
Regex-router is a simple Node.js library to simplify routing. By simple, I mean 50 lines of code. | ||
# Example | ||
var fs = require('fs'), | ||
http = require('http'), | ||
Router = require('regex-router'), | ||
r = new Router(); | ||
var fs = require('fs'); | ||
var http = require('http'); | ||
var Router = require('regex-router'); | ||
var r = new Router(); | ||
@@ -29,1 +29,5 @@ r.get(/^\/page\/(\w+)/, function(m, req, res) { | ||
}).listen(80, 'localhost'); | ||
## License | ||
Copyright © 2012-2013 Christopher Brown. [MIT Licensed](LICENSE). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4013
33
44