MCPcopy Index your code
hub / github.com/tinyhttp/tinyhttp / add

Method add

packages/router/src/index.ts:203–216  ·  view source on GitHub ↗
(method: Method)

Source from the content-addressed store, hash-verified

201 }
202
203 add(method: Method) {
204 return (...args: RouterMethodParams<Req, Res>) => {
205 const handlers = args.slice(1).flat() as Handler<Req, Res>[]
206 pushMiddleware<Req, Res>(this.middleware)({
207 path: args[0],
208 handler: handlers[0],
209 handlers: handlers.slice(1),
210 method,
211 type: 'route'
212 })
213
214 return this
215 }
216 }
217
218 msearch(...args: RouterMethodParams<Req, Res>) {
219 const handlers = args.slice(1).flat() as Handler<Req, Res>[]

Callers 1

constructorMethod · 0.95

Calls 1

pushMiddlewareFunction · 0.85

Tested by

no test coverage detected