express.mts
This file
Path
benchmarks/routers/src/express.mts
24 lines · 715 bytes · TypeScript
Last changed by
chore(benchmark/routers): bump deps (#5107)Yusuke Wadabefore adoption29a3f73
History of this fileTake it
The walk stopped after 200 commits: lines older than 83bfb3b point at it.
chore(benchmark/routers): bump deps (#5107)Yusuke Wadabefore adoption29a3f73
line 1why, one step back1import express from 'express'4.12.23Yusuke Wadabefore adoption83bfb3b
lines 2–4why, one step back2import type { RouterInterface } from './tool.mts'3import { routes, handler } from './tool.mts'4chore(benchmark/routers): bump deps (#5107)Yusuke Wadabefore adoption29a3f73
line 5why, one step back5const router = express.Router()4.12.23Yusuke Wadabefore adoption83bfb3b
lines 6–8why, one step back6const name = 'express (WARNING: includes handling)'78for (const route of routes) {chore(benchmark/routers): bump deps (#5107)Yusuke Wadabefore adoption29a3f73
lines 9–10why, one step back9 // path-to-regexp v8 (express 5) requires named wildcards10 const path = route.path.replace(/\/\*$/, '/*splat')4.12.23Yusuke Wadabefore adoption83bfb3b
line 11why, one step back11 if (route.method === 'GET') {chore(benchmark/routers): bump deps (#5107)Yusuke Wadabefore adoption29a3f73
line 12why, one step back12 router.route(path).get(handler)4.12.23Yusuke Wadabefore adoption83bfb3b
line 13why, one step back13 } else {chore(benchmark/routers): bump deps (#5107)Yusuke Wadabefore adoption29a3f73
line 14why, one step back14 router.route(path).post(handler)4.12.23Yusuke Wadabefore adoption83bfb3b
lines 15–20why, one step back15 }16}1718export const expressRouter: RouterInterface = {19 name,20 match: (route) => {chore(benchmark/routers): bump deps (#5107)Yusuke Wadabefore adoption29a3f73
lines 21–22why, one step back21 // eslint-disable-next-line @typescript-eslint/no-explicit-any22 ;(router as any).handle({ method: route.method, url: route.path }, {}, () => {})4.12.23Yusuke Wadabefore adoption83bfb3b
lines 23–24why, one step back23 },24}