Mercurial
comparison benchmark/bun-http-framework-benchmark/src/bun/fastify.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 fastify from "fastify" | |
| 2 | |
| 3 const server = fastify() | |
| 4 .get("/", () => "Hi") | |
| 5 .get("/id/:id", (req, res) => { | |
| 6 res.header("x-powered-by", "benchmark") | |
| 7 return `${req.params.id} ${req.query.name}` | |
| 8 }) | |
| 9 .post("/json", (req, _res) => req.body) | |
| 10 | |
| 11 server.listen({ port: 3000 }, function (err) { | |
| 12 if (err) { | |
| 13 server.log.error(err) | |
| 14 process.exit(1) | |
| 15 } | |
| 16 }); |