comparison benchmark/bun-http-framework-benchmark/src/node/fastify.js @ 186:8cf4ec5e2191 hg-web

Fixed merge conflict.
author MrJuneJune <me@mrjunejune.com>
date Fri, 23 Jan 2026 22:38:59 -0800
parents a8976a008a9d
children
comparison
equal deleted inserted replaced
176:fed99fc04e12 186:8cf4ec5e2191
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 });