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

Function add

packages/effect/src/unstable/http/HttpRouter.ts:502–513  ·  view source on GitHub ↗
(
  method: "*" | "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS",
  path: PathInput,
  handler:
    | HttpServerResponse.HttpServerResponse
    | Effect.Effect<HttpServerResponse.HttpServerResponse, E, R>
    | ((request: HttpServerRequest.HttpServerRequest) => Effect.Effect<HttpServerResponse.HttpServerResponse, E, R>),
  options?: {
    readonly uninterruptible?: boolean | undefined
  }
)

Source from the content-addressed store, hash-verified

500 * @since 4.0.0
501 */
502export const add = <E = never, R = never>(
503 method: "*" | "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS",
504 path: PathInput,
505 handler:
506 | HttpServerResponse.HttpServerResponse
507 | Effect.Effect<HttpServerResponse.HttpServerResponse, E, R>
508 | ((request: HttpServerRequest.HttpServerRequest) => Effect.Effect<HttpServerResponse.HttpServerResponse, E, R>),
509 options?: {
510 readonly uninterruptible?: boolean | undefined
511 }
512): Layer.Layer<never, never, HttpRouter | Request.From<"Requires", Exclude<R, Provided>> | Request.From<"Error", E>> =>
513 use((router) => router.add(method, path, handler, options))
514
515/**
516 * Create a layer that adds multiple routes to the HTTP router.

Callers

nothing calls this directly

Calls 2

useFunction · 0.70
addMethod · 0.65

Tested by

no test coverage detected