deno.land / x / opine@2.3.4 / benchmarks / middleware.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import opine from "../mod.ts";import { Application, NextFunction, OpineRequest, OpineResponse,} from "../src/types.ts";
const app: Application = opine();
let middlewareCount: number = parseInt(Deno.env.get("MW") || "1");
console.log("%s middleware", middlewareCount);
while (middlewareCount--) { app.use( (_req: OpineRequest, _res: OpineResponse, next: NextFunction): void => { next(); }, );}
app.use((_req: OpineRequest, res: OpineResponse, _next: NextFunction): void => { res.send("Hello World");});
app.listen({ port: 3333 });
opine

Version Info

Tagged at
a year ago