Mercurial
comparison benchmark/bun-http-framework-benchmark/src/bun/bunrest.ts @ 183:a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Fri, 23 Jan 2026 21:19:08 -0800 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 179:8d17f6e6e290 | 183:a8976a008a9d |
|---|---|
| 1 import Server from 'bunrest' | |
| 2 | |
| 3 const app = Server() | |
| 4 const xPoweredBy = 'benchmark' | |
| 5 | |
| 6 app.get('/', (req, res) => { | |
| 7 res.send('Hi') | |
| 8 }) | |
| 9 | |
| 10 // ? Can't read body | |
| 11 app.post('/json', async (req, res) => { | |
| 12 res.send(await req.json()) | |
| 13 }) | |
| 14 | |
| 15 // ? Named parameter not implemented? | |
| 16 app.get('/id/:id', ({ params: { id }, query: { name } }, res) => { | |
| 17 const headers = new Headers() | |
| 18 headers.set('x-powered-by', xPoweredBy) | |
| 19 | |
| 20 res.headers(headers) | |
| 21 res.send(`${id} ${name}`) | |
| 22 }) | |
| 23 | |
| 24 app.listen(3000) |