Comparing version 0.4.10 to 0.4.11
var router = require('router').create(); | ||
var prefixed = router.prefix('/foo') | ||
@@ -15,2 +16,12 @@ router.get('/s/{prefix}?/{top}', function(req, res) { | ||
}); | ||
prefixed.get('/test', function(req, res) { | ||
res.writeHead(200); | ||
res.end('prefix test!'); | ||
}); | ||
prefixed.get('/test/{sub}', function(req, res) { | ||
res.writeHead(200, {'content-type':'application/javascript'}); | ||
res.end(JSON.stringify(req.params)); | ||
}); | ||
router.all(function(req, res) { | ||
@@ -21,2 +32,3 @@ res.writeHead(200); | ||
router.listen(9999); |
@@ -163,2 +163,8 @@ var http = require('http'); | ||
}; | ||
that.prefix = function(prefix) { | ||
var prefixed = createRouter(); | ||
that.all((prefix || '').replace(/\/$/,'')+'/*', '/{*}', prefixed.route); | ||
return prefixed; | ||
}; | ||
@@ -165,0 +171,0 @@ return that.bind(server); |
{ | ||
"name":"router", | ||
"version":"0.4.10", | ||
"version":"0.4.11", | ||
"description":"A lean and mean web router", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
8403
196