MCPcopy Create free account
hub / github.com/Effect-TS/effect / prefixed

Function prefixed

packages/effect/src/unstable/http/HttpRouter.ts:164–184  ·  view source on GitHub ↗
(this: HttpRouter, prefix: string)

Source from the content-addressed store, hash-verified

162 return HttpRouter.of({
163 [TypeId]: TypeId,
164 prefixed(this: HttpRouter, prefix: string) {
165 return HttpRouter.of({
166 ...this,
167 prefixed: (newPrefix: string) => this.prefixed(prefixPath(prefix, newPrefix)),
168 addAll: (routes) => addAll(routes.map(prefixRoute(prefix))) as any,
169 add: (method, path, handler, options) =>
170 addAll([
171 makeRoute({
172 method,
173 path: prefixPath(path, prefix) as PathInput,
174 handler: HttpServerResponse.isHttpServerResponse(handler) ?
175 Effect.succeed(handler) :
176 Effect.isEffect(handler)
177 ? handler
178 : Effect.flatMap(HttpServerRequest.HttpServerRequest, handler),
179 uninterruptible: options?.uninterruptible ?? false,
180 prefix
181 })
182 ])
183 })
184 },
185 addAll,
186 add: (method, path, handler, options) => addAll([route(method, path, handler, options)]),
187 addGlobalMiddleware: (middleware_) =>

Callers

nothing calls this directly

Calls 5

makeRouteFunction · 0.85
addAllFunction · 0.70
ofMethod · 0.65
mapMethod · 0.45
succeedMethod · 0.45

Tested by

no test coverage detected