comparison benchmark/bun-http-framework-benchmark/src/node/koa.js @ 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 const Koa = require('koa')
2 const Router = require('koa-router')
3 const bodyParser = require('koa-bodyparser')
4
5 const app = new Koa()
6 const router = new Router()
7
8 app.use(bodyParser())
9
10 router
11 .get('/', (ctx) => {
12 ctx.body = 'Hi'
13 })
14 .get('/id/:id', (ctx) => {
15 ctx.body = `${ctx.params.id} ${ctx.query.name}`
16 ctx.set('x-powered-by', 'benchmark')
17 })
18 .post('/json', (ctx) => {
19 ctx.body = ctx.request.body
20 })
21
22 app.use(router.routes())
23 app.use(router.allowedMethods())
24 app.listen(3000)