Mercurial
comparison benchmark/bun-http-framework-benchmark/src/bun/byte.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 { Byte, query, send } from '@bit-js/byte' | |
| 2 | |
| 3 const xPoweredBy = ['X-Powered-By', 'benchmark'] as [string, string] | |
| 4 | |
| 5 // Extract the 'name' parameter value from query | |
| 6 const getName = query.get('name') | |
| 7 | |
| 8 // Serve directly | |
| 9 export default new Byte() | |
| 10 .get('/', send.body('Hi')) | |
| 11 // Send ID with query | |
| 12 .get('/id/:id', (ctx) => { | |
| 13 ctx.headers.push(xPoweredBy) | |
| 14 return ctx.body(`${ctx.params.id} ${getName(ctx)}`) | |
| 15 }) | |
| 16 // Yield body | |
| 17 .post('/json', async (ctx) => ctx.json(await ctx.req.json())) |