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

Function layer

packages/effect/src/unstable/httpapi/HttpApiSwagger.ts:59–68  ·  view source on GitHub ↗
(
  api: HttpApi.HttpApi<Id, Groups>,
  options?: {
    readonly path?: `/${string}` | undefined
  }
)

Source from the content-addressed store, hash-verified

57 * @since 4.0.0
58 */
59export const layer = <Id extends string, Groups extends HttpApiGroup.Constraint>(
60 api: HttpApi.HttpApi<Id, Groups>,
61 options?: {
62 readonly path?: `/${string}` | undefined
63 }
64): Layer.Layer<never, never, HttpRouter.HttpRouter> =>
65 HttpRouter.use(Effect.fnUntraced(function*(router) {
66 const handler = makeHandler({ api })
67 yield* router.add("GET", options?.path ?? "/docs", handler)
68 }))

Callers

nothing calls this directly

Calls 3

makeHandlerFunction · 0.70
useMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected