Observed since 20 Oct, 17:41 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
0http
Cero friction HTTP request router. The need for speed!
Zero friction HTTP framework:

Check it yourself: https://web-frameworks-benchmark.netlify.app/result?f=feathersjs,0http,koa,fastify,nestjs-express,express,sails,nestjs-fastify,restana
Install the package from npm:
npm install 0http
const cero = require('0http')
const { router, server } = cero()
router.get('/hello', (req, res) => {
res.end('Hello World!')
})
router.post('/do', (req, res) => {
// ...
res.statusCode = 201
res.end()
})
//...
server.listen(3000)
A segment-trie router with the same API, middleware chaining, nested routers and error containment as the default sequential router, but no regex per route, no route cache to size, and no external dependencies. Static routes resolve in constant time and dynamic routes stay flat as the route count grows.
const trie = require('0http/lib/router/trie')
const { router, server } = cero({ router: trie() })
router.use((req, res, next) => next())
router.get('/users/:id', (req, res) => res.end(req.params.id))
router.get('/files/*', (req, res) => res.end(req.params['*']))
Options: caseSensitive (default true), ignoreTrailingSlash (default
true), plus defaultRoute, errorHandler and id. Patterns: /static,
/:param, /:param?, /:name.ext (or /:name.ext?), trailing /* and
RegExp (named groups become params). Static segments are literal, so /a+b
only matches /a+b.
Differences from the sequential router, on purpose:
caseSensitive: false folds ASCII letters only.* that is not the last segment, or a ? that is not the last character
of a param segment, throws at registration instead of matching too much.req.params (the
sequential router sets it to undefined, which also clobbers an inherited
param of the same name)./* also matches the bare prefix, with '*' equal to ''./a//b is /a/b); the sequential router
truncates the route at the first empty segment.ignoreTrailingSlash: false, a route registered as /dir/ matches
/dir/ only and /dir matches /dir only./ matches nothing.router.routes lists RegExp routes only; there is no cacheSize option.You can support the maintenance of this project:
errorHandler that
itself throws or rejects is also contained with a bare 500. If the response
has already ended, the custom errorHandler is skipped (writing to an ended
response would raise an uncatchable stream error). A throwing or rejecting
defaultRoute is contained the same way.GET /api/acme?x=/admin reaches
the router mounted at /api/:tenant as /?x=/admin, never as /admin./Admin, /admin and
/ADMIN all match a route registered as /admin. Reverse proxies, WAFs and
auth layers that classify paths case-sensitively must be aligned accordingly.
The trie router is case-sensitive by default and treats static segments
literally (no regex meaning), so it agrees with such layers out of the box.use(). Only router.use(prefix, subRouter)
rewrites the URL when entering a nested router. A router passed to get() or
on() is treated as a plain middleware and will not match its sub-routes.404 itself and the parent chain is not
resumed (unlike Express mounted apps, which fall through).404s, and
paths longer than 4KB are never cached, and the cache is additionally capped
by total size — so attacker-controlled unique paths cannot pin memory. The
trie router has no request-keyed cache at all: its static table holds one
entry per registered route and known HTTP method, never per request path.Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
trouterEnvironment{
"local_name": "trouter",
"alias": false,
"peer_metadata": null
} | ^3.2.0 | runtime |
lru-cacheEnvironment{
"local_name": "lru-cache",
"alias": false,
"peer_metadata": null
} | ^7.14.1 | runtime |
regexparamEnvironment{
"local_name": "regexparam",
"alias": false,
"peer_metadata": null
} | ^2.0.1 | runtime |
nycEnvironment{
"local_name": "nyc",
"alias": false,
"peer_metadata": null
} | ^15.1.0 | development |
chaiEnvironment{
"local_name": "chai",
"alias": false,
"peer_metadata": null
} | ^4.3.7 | development |
mochaEnvironment{
"local_name": "mocha",
"alias": false,
"peer_metadata": null
} | ^10.1.0 | development |
cross-envEnvironment{
"local_name": "cross-env",
"alias": false,
"peer_metadata": null
} | ^7.0.3 | development |
supertestEnvironment{
"local_name": "supertest",
"alias": false,
"peer_metadata": null
} | ^6.3.3 | development |
body-parserEnvironment{
"local_name": "body-parser",
"alias": false,
"peer_metadata": null
} | ^1.20.1 | development |
find-my-wayEnvironment{
"local_name": "find-my-way",
"alias": false,
"peer_metadata": null
} | ^5.2.0 | development |
Source distribution
{
"shasum": "ac0a8b4c71562480067201452caf8e1581acd924",
"tarball": "https://registry.npmjs.org/0http/-/0http-3.4.2.tgz",
"fileCount": 8,
"integrity": "sha512-zDbvsof0hqUdtHjcXE8pCzAmBGhNjwhypDfMKQf4sJz9QB9CMphgQzo/te2bGz7GjEuqiwXss7z7DJMt7IQo3Q==",
"signatures": [
{
"sig": "MEQCIDuFBgpzWf/Cwqhzrb1KsCuQNc3BsSAM2eM2LXnXuaPVAiAuGTPwIEhck/unTBji96PELzknob7LmGyIFWW3RIBrhA==",
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
}
],
"unpackedSize": 8577,
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjlFgTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqzqA//VlHsxKwRuFe4FBi1qWI6BP9XiFFC9o8SuH7Szi3twZNUc9R3\r\nbZJZpgmlz3kjYXS+TvM1HcrWmQl2+9MU1yt/oOJLMoZt7RFpzqG/VU7425UD\r\njOquiLcvQ8rCMLE2TNKLTIl9h/8pujucksSc0+OD0rXwgGoD/q+CcszpZ+Bu\r\nFm4M2lOgjLXC5aXe2Ehbq5O3b1mYSIuJnPH9t6NYeS0fBugbf8lQpXHtcgZ0\r\nvu13JlRuU6IB0o1nuc4OxWzvfY7UQ5l+eqyWVX+k/3PxkjDryHvLZKI2QViX\r\noYKTfDT7uLGqqg1GggqLb1PKcMxaowx9XCY0v/EQUXuARC5XePxuqtBQYw0J\r\nuzbjt0GhjFyRSsf5peZ8lelUrrhu3prtLJuAmjWYdV+D0MSSp569tgtNf0NI\r\nT/X+bGvSjQyBF+49eHIgu1k8Bps7Wy0gfgUEAqE++WEyiICpgB53dxqxmHou\r\nZKYJCFg93HwEuxSWZV6OR6Nko2bvMSUz9c1ASPa1Rzw0+jh+VPvQS0HOpIrM\r\nkTBQ168Fyx5mUymJ98mv0NxbujtlFZfCFYHjzZ5jrs17B/oxhJbgU+Y54/QK\r\nnifXz2Sf7W7y4bt9YHh/Tkz2sRcheIyKTMt6YeRK9PdDfMzyJGrNIEoNqfUA\r\ntttMuAFR8Gqkab7pWBSbEKE35jGETpy3tHU=\r\n=7k0D\r\n-----END PGP SIGNATURE-----\r\n"
}Observed since 20 Oct, 17:41 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:447f3532faa2f6a7e32d6df24da49a40ae02ec9b1d5df584b8035ccce98bed40