Socket
Socket
Sign inDemoInstall

router

Package Overview
Dependencies
Maintainers
2
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

router - npm Package Compare versions

Comparing version 0.4.10 to 0.4.11

12

example.js
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);

2

package.json
{
"name":"router",
"version":"0.4.10",
"version":"0.4.11",
"description":"A lean and mean web router",

@@ -5,0 +5,0 @@ "contributors": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc