Mercurial
comparison benchmark/bun-http-framework-benchmark/src/deno/deno-web-standard.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 // @ts-nocheck | |
| 2 Deno.serve({ port: 3000 }, async (request) => { | |
| 3 const url = new URL(request.url) | |
| 4 | |
| 5 switch (request.method) { | |
| 6 case 'GET': | |
| 7 switch (url.pathname) { | |
| 8 case '/': | |
| 9 return new Response('Hi') | |
| 10 } | |
| 11 | |
| 12 if (url.pathname.startsWith('/id/')) { | |
| 13 const [id, rest] = url.pathname.slice(4).split('/') | |
| 14 | |
| 15 if (!rest) | |
| 16 return new Response( | |
| 17 `${id} ${url.searchParams.get('name')}`, | |
| 18 { | |
| 19 headers: { | |
| 20 'x-powered-by': 'benchmark' | |
| 21 } | |
| 22 } | |
| 23 ) | |
| 24 } | |
| 25 | |
| 26 return new Response('Not Found', { | |
| 27 status: 404 | |
| 28 }) | |
| 29 | |
| 30 case 'POST': | |
| 31 switch (url.pathname) { | |
| 32 case '/json': | |
| 33 return Response.json(await request.json()) | |
| 34 | |
| 35 default: | |
| 36 return new Response('Not Found', { | |
| 37 status: 404 | |
| 38 }) | |
| 39 } | |
| 40 | |
| 41 default: | |
| 42 return new Response('Not Found', { | |
| 43 status: 404 | |
| 44 }) | |
| 45 } | |
| 46 }) |