comparison benchmark/bun-http-framework-benchmark/src/bun/nbit.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 { createApplication } from "@nbit/bun"
2
3 const { defineRoutes, attachRoutes } = createApplication()
4
5 const xPoweredBy = "benchmark"
6
7 const routes = defineRoutes((app) => [
8 app.get("/", () => new Response("Hi")),
9 app.post("/json", async (request) => request.json()),
10 app.get("/id/:id", async (request) => {
11 const id = request.params.id
12 const name = request.query.get("name")
13
14 return new Response(`${id} ${name}`, {
15 headers: {
16 "x-powered-by": xPoweredBy
17 }
18 })
19 })
20 ])
21
22 Bun.serve({
23 port: 3000,
24 fetch: attachRoutes(routes)
25 })