
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
http-router
Advanced tools
router module for node.js
$ npm install http-router
var http = require('http'),
router = require('http-router'),
routes = router.createRouter(); // or routes = new router;
routes
.get('/', function(req, res, next) {
res.write('Hello, ');
return next();
})
.get({
path: '/',
callback: function(req, res, next) {
res.end('World!\n');
}
})
.post('/', function(req, res, next) {
res.write('PO');
return next();
})
.post('/', function(req, res, next) {
res.end('ST!\n');
})
.get('/:key1/:key2', function(req, res, next) {
res.write('key1: ' + req.params.key1 + '\n');
res.write('key2: ' + req.params.key2 + '\n');
res.end();
})
.get(function(req, res, next) {
res.writeHead(404);
return next();
})
.get(function(req, res, next) {
res.end(http.STATUS_CODES[404] + '\n');
});
http.createServer(function(req, res) {
if (!routes.route(req, res)) {
res.writeHead(501);
res.end(http.STATUS_CODES[501] + '\n');
}
}).listen(3000);
$ curl -X GET http://localhost:3000
Hello, World!
$ curl -X POST http://localhost:3000
POST!
$ curl -X GET http://localhost:3000/111/222
key1: 111
key2: 222
$ curl -X GET http://localhost:3000/unknown
Not Found
$ curl -X PATCH http://localhost:3000
Not Implemented
$ npm install
$ npm test
return Router - new Router instance.Return new Router instance. It's similar to new require('http-router').
req http.IncomingMessage - IncomingMessage object
res http.ServerResponse - ServerResponse object
return boolean - return false if not called any callback functions.
Call appended callback functions if match to route's path. Call empty path's callback if not match to any route's path.
path string|function|object - request path
callback function(req, res, next)|undefined - callback function
req http.IncomingMessage - IncomingMessage objectres http.ServerResponse - ServerResponse objectnext function() - call next callback functionreturn Router - return own instance.
Append path and callback function.
The MIT License. Please see LICENSE file.
FAQs
router module for node.js
We found that http-router demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.