bun-http-framework-benchmark icon indicating copy to clipboard operation
bun-http-framework-benchmark copied to clipboard

feat: add ultimate-express

Open ismoiliy98 opened this issue 1 year ago • 2 comments

Add ultimate-express node framework

ismoiliy98 avatar Sep 29 '24 08:09 ismoiliy98

You should add app.set("etag", false), since a lot of performance will be taken to just hash responses instead of actually routing (a lot of frameworks don't add etag out of box, so it wouldn't be a fair benchmark)

dimdenGD avatar Sep 29 '24 11:09 dimdenGD

You should also only read body on endpoint that actually needs it. I also made some fixes and performance improvements to library, update it to 1.2.5 please.

Code after changes should be:

const uExpress = require('ultimate-express')

const app = uExpress()
app.set("etag", false)

app.get('/', (req, res) => {
	res.setHeader('content-type', 'text/plain').send('Hi')
})

app.post('/json', uExpress.json(), ({ body }, res) => {
	res.json(body)
})

app.get('/id/:id', ({ params: { id }, query: { name } }, res) => {
	res.setHeader('x-powered-by', 'benchmark')
		.setHeader('content-type', 'text/plain')
		.send(`${id} ${name}`)
})

app.listen(3000, () => {})

dimdenGD avatar Sep 29 '24 15:09 dimdenGD