A low level http library for Node.js based on turbo-net
npm install turbo-http
WIP, this module is already really fast but there are some HTTP features missing and easy perf gains to be had :D :D :D
On my laptop I can serve simple hello world payloads at around 100k requests/seconds compared to 10k requests/second using node core.
const turbo = require('turbo-http')
const server = turbo.createServer(function (req, res) {
res.setHeader('Content-Length', '11')
res.write(Buffer.from('hello world'))
})
server.listen(8080)
Create a new http server. Inherits from the turbo-net tcp server
Emitted when a new http request is received.
Set the http status
Set a http header
Write a buffer. When the callback is called, the buffer has been completely flushed to the underlying socket and is safe to reuse for other purposes
Write more that one buffer at once.
End the request. Only needed if you do not provide a Content-Length
.
Request url
Request method
Request turbo-net socket
Get a request header.
Get all request headers as a map.
Called when there is data read. If you use the buffer outside of this function you should copy it.
Called when the request is fully read.
This project was kindly sponsored by nearForm.
MIT