Mercurial
comparison benchmark/bun-http-framework-benchmark/src/node/fastify.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 fastify = require("fastify"); | |
| 2 | |
| 3 const server = fastify() | |
| 4 .get("/", (req, res) => "Hi") | |
| 5 .get( | |
| 6 "/id/:id", | |
| 7 ( | |
| 8 req, | |
| 9 res | |
| 10 ) => { | |
| 11 res.header("x-powered-by", "benchmark"); | |
| 12 return `${req.params.id} ${req.query.name}`; | |
| 13 } | |
| 14 ) | |
| 15 .post( | |
| 16 "/json", | |
| 17 { | |
| 18 schema: { | |
| 19 response: { | |
| 20 200: { | |
| 21 type: "object", | |
| 22 properties: { | |
| 23 hello: { | |
| 24 type: "string", | |
| 25 }, | |
| 26 }, | |
| 27 }, | |
| 28 }, | |
| 29 }, | |
| 30 }, | |
| 31 (req, res) => req.body | |
| 32 ) | |
| 33 | |
| 34 | |
| 35 server.listen({ port: 3000 }, function (err) { | |
| 36 if (err) { | |
| 37 server.log.error(err); | |
| 38 process.exit(1); | |
| 39 } | |
| 40 }); |