Zero friction HTTP framework:
- Tweaked Node.js HTTP server for high throughput.
- High-performance and customizable request routers.
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 0httpconst 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)You can support the maintenance of this project:
- PayPal: https://www.paypal.me/kyberneees
- Errors never crash the process. A route handler that throws (or rejects)
after response headers are already sent is contained: the response is ended or
the socket closed, and the server keeps serving. A custom
errorHandlerthat itself throws or rejects is also contained with a bare500. - Route matching is case-insensitive.
/Admin,/adminand/ADMINall match a route registered as/admin. Reverse proxies, WAFs and auth layers that classify paths case-sensitively must be aligned accordingly. - Mount nested routers with
use(). Onlyrouter.use(prefix, subRouter)rewrites the URL when entering a nested router. A router passed toget()oron()is treated as a plain middleware and will not match its sub-routes. - Nested routers own unmatched requests. If a mounted router finds no route
for the rewritten URL, it responds
404itself and the parent chain is not resumed (unlike Express mounted apps, which fall through). - The route cache is memory-bounded. Matches with parameters,
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.
- Website and documentation: https://0http.21no.de
