(
this: unknown,
url:
| string
| null
| MiddlewareFn<Req, Res, Ctx>
| MiddlewareFn<Req, Res, Ctx>[],
f?: MiddlewareFn<Req, Res, Ctx> | MiddlewareFn<Req, Res, Ctx>[],
)
| 62 | }; |
| 63 | |
| 64 | function use( |
| 65 | this: unknown, |
| 66 | url: |
| 67 | | string |
| 68 | | null |
| 69 | | MiddlewareFn<Req, Res, Ctx> |
| 70 | | MiddlewareFn<Req, Res, Ctx>[], |
| 71 | f?: MiddlewareFn<Req, Res, Ctx> | MiddlewareFn<Req, Res, Ctx>[], |
| 72 | ) { |
| 73 | if (f === undefined) { |
| 74 | f = url as MiddlewareFn<Req, Res, Ctx> | MiddlewareFn<Req, Res, Ctx>[]; |
| 75 | url = null; |
| 76 | } |
| 77 | |
| 78 | let regexp: RegExp | undefined; |
| 79 | if (typeof url === 'string') { |
| 80 | const pathRegExp = pathToRegexp(sanitizePrefixUrl(url) as Path, { |
| 81 | end: false, |
| 82 | }); |
| 83 | regexp = pathRegExp.regexp; |
| 84 | } |
| 85 | |
| 86 | if (Array.isArray(f)) { |
| 87 | for (const val of f) { |
| 88 | middlewares.push({ regexp, fn: val }); |
| 89 | } |
| 90 | } else { |
| 91 | middlewares.push({ regexp, fn: f }); |
| 92 | } |
| 93 | |
| 94 | return this; |
| 95 | } |
| 96 | |
| 97 | function run( |
| 98 | req: Req, |
nothing calls this directly
no test coverage detected