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

Function layerCdn

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

Source from the content-addressed store, hash-verified

238 * @since 4.0.0
239 */
240export const layerCdn = <Id extends string, Groups extends HttpApiGroup.Constraint>(
241 api: HttpApi.HttpApi<Id, Groups>,
242 options?: {
243 readonly path?: `/${string}` | undefined
244 readonly scalar?: ScalarConfig
245 readonly version?: string | undefined
246 } | undefined
247): Layer.Layer<never, never, HttpRouter.HttpRouter> =>
248 HttpRouter.use(Effect.fnUntraced(function*(router) {
249 const handler = makeHandler({
250 api,
251 source: {
252 _tag: "Cdn",
253 version: options?.version
254 },
255 scalar: options?.scalar
256 })
257 yield* router.add("GET", options?.path ?? "/docs", handler)
258 }))

Callers

nothing calls this directly

Calls 3

makeHandlerFunction · 0.70
useMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected