router
npmv2.2.0Simple middleware-style router
Adopt with care
router is usable, with caveats. Last published 532 days ago. 3 releases in the last 2 years.
- AAdoption: grade A, Excellent.
59.4M downloads per week and 1 known dependents.
- CMaintenance: grade C, Fair — worth a look.
Last published 532 days ago. 3 releases in the last 2 years.
- BWeight: grade B, Good.
Pulls in 6 transitive packages, about 192 KB installed.
- ASupply chain: grade A, Excellent.
No install scripts, 3 maintainers, and a contained dependency surface.
- ALicense: grade A, Excellent.
MIT — permissive, with no copyleft found in the dependency tree.
Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.
Install cost
What you actually take on by adding router to a project.
Runtime packages this one declares itself.
Distinct packages in the full runtime tree, deduplicated the way a package manager would.
Unpacked size of this package plus its entire runtime tree.
Longest resolved dependency chain below this package.
Licenses in the dependency tree
Every license you inherit by installing router, not just its own. Check this before a legal review, not after.
Compatibility
- Node.js
- node >= 18
- Module format
- CommonJS only
- TypeScript
- No bundled types
- Install scripts
- None
Quick start
A usage example from the router README.
var finalhandler = require('finalhandler')
var http = require('http')
var Router = require('router')
var router = Router()
router.get('/', function (req, res) {
res.setHeader('Content-Type', 'text/plain; charset=utf-8')
res.end('Hello World!')
})
var server = http.createServer(function (req, res) {
router(req, res, finalhandler(req, res))
})
Dependencies
Declared by router v2.2.0. Runtime dependencies are installed with the package; dev dependencies are not.
Dev (6)
Used by
Popular packages that depend on router.
Relationship graph
Dependencies (left) and dependents (right) of router.
Frequently installed together
Create and parse HTTP Content-Type header
The ultimate javascript content-type utility.
Create HTTP error objects
An AST-based pattern checker for JavaScript.
Encode a URL to a percent-encoded form, excluding already-encoded sequences
Node.js final http responder
Infer the content-type of a request.
Better streaming static file server with Range and conditional-GET support
Merge objects using their property descriptors
Run a function exactly one time
Deprecate all the things
Manipulate the HTTP Vary header
Release history
2 releases in the last two years, typically about 154 days apart.
| Version | Published | Size | License |
|---|---|---|---|
| 2.2.0latest | 1 year ago | 46 KB | MIT |
| 2.1.0 | 1 year ago | 46 KB | MIT |
| 2.0.0 | 2 years ago | 46 KB | MIT |
| 2.0.0-beta.2 | 2 years ago | 44 KB | MIT |
| 1.3.8 | 3 years ago | 42 KB | MIT |
| 1.3.7 | 4 years ago | 41 KB | MIT |
| 1.3.6 | 4 years ago | 40 KB | MIT |
| 2.0.0-beta.1 | 6 years ago | 42 KB | MIT |
| 1.3.5 | 6 years ago | 40 KB | MIT |
| 1.3.4 | 6 years ago | 39 KB | MIT |
| 2.0.0-alpha.1 | 8 years ago | 40 KB | MIT |
| 1.3.3 | 8 years ago | 39 KB | MIT |
| 1.3.2 | 9 years ago | — | MIT |
| 1.3.1 | 9 years ago | — | MIT |
| 1.3.0 | 9 years ago | — | MIT |
Overview
router is an npm package that simple middleware-style router. It is extremely widely used, with about 59.4M downloads per week and 1 known dependents in the graph. The latest version is 2.2.0, released under the MIT license.
Who should use it
Teams working in the npm ecosystem who need simple middleware-style router and value a battle-tested, widely-adopted solution.
When not to use it
Consider an alternative if you need to have first-class TypeScript types out of the box, or if a more actively-maintained option better fits your npm stack.
Pros
- Large, well-established user base (59.4M weekly downloads).
- Clear open-source license (MIT).
Cons
- No bundled TypeScript types (may require a separate @types package).
Auto-generated from collected registry metadata. No external claims are inferred.
Maintainers
Frequently asked questions
Should I use router?
router is usable, with caveats. Last published 532 days ago. 3 releases in the last 2 years.
How do I install router?
Run `npm install router` to add router to your npm project.
How many dependencies does router have?
router declares 11 direct dependencies and pulls in 6 packages in total once its runtime tree is resolved totalling about 192 KB on disk.
What license is router released under?
router is distributed under the MIT license.
How popular is router?
router has approximately 59,413,889 downloads per week and 1 known dependent packages.
Is router still maintained?
The most recent release of router (v2.2.0) was published 1 year ago.
Does router run install scripts?
No. router does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.