MCPcopy Create free account
hub / github.com/effect-app/libs / prefixed

Function prefixed

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

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…