Mercurial
comparison benchmark/bun-http-framework-benchmark/src/deno/oak.ts @ 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 import { Application, Router } from "@oak/oak" | |
| 2 | |
| 3 const router = new Router() | |
| 4 .get("/", (context) => { | |
| 5 context.response.body = "Hi" | |
| 6 }) | |
| 7 .get("/id/:id", (context) => { | |
| 8 context.response.headers.append("x-powered-by", "benchmark") | |
| 9 context.response.body = `${ | |
| 10 context.params.id | |
| 11 } ${context.request.url.searchParams.get("name")}` | |
| 12 }) | |
| 13 .post("/json", async (context) => { | |
| 14 context.response.body = await context.request.body.json() | |
| 15 }) | |
| 16 | |
| 17 const app = new Application() | |
| 18 app.use(router.routes()) | |
| 19 app.use(router.allowedMethods()) | |
| 20 | |
| 21 await app.listen({ port: 3000 }) |