comparison benchmark/bun-http-framework-benchmark/src/node/hyper-express.js @ 185:dfdd66825396

Merged in keep alive changes and mrjunejune changes.
author MrJuneJune <me@mrjunejune.com>
date Fri, 23 Jan 2026 22:22:30 -0800
parents a8976a008a9d
children
comparison
equal deleted inserted replaced
182:d6ab5921fedc 185:dfdd66825396
1 const { Server } = require('hyper-express')
2
3 const app = new Server()
4
5 app.get('/', (req, res) => {
6 res.header('content-type', 'text/plain').send('Hi')
7 })
8
9 app.get('/id/:id', (req, res) => {
10 res.header('x-powered-by', 'benchmark')
11 res.header('content-type', 'text/plain')
12
13 res.send(`${req.path_parameters.id} ${req.query_parameters.name}`)
14 })
15
16 app.post('/json', async (req, res) => {
17 res.type('json')
18 res.send(JSON.stringify(await req.json()))
19 })
20
21 app.listen(3000)