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

Function route

repos/effect/packages/effect/src/unstable/http/HttpRouter.ts:654–675  ·  view source on GitHub ↗
(
  method: "*" | HttpMethod.HttpMethod,
  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

652 uninterruptible: options.uninterruptible ?? false,
653 prefix: typeof options.prefix === "string" ? Option.some(options.prefix) : options.prefix ?? Option.none(),
654 [RouteTypeId]: RouteTypeId
655}) as Route<E, Exclude<R, Provided>>)
656
657/**
658 * Constructs a `Route` from an HTTP method, path, and handler.
659 *
660 * **Details**
661 *
662 * The handler may be a static response, an effect that produces a response, or a
663 * function from the current request to a response effect. Set `uninterruptible` to
664 * prevent the route handler from being made interruptible while it runs.
665 *
666 * @category routes
667 * @since 4.0.0
668 */
669export const route = <E = never, R = never>(
670 method: "*" | HttpMethod.HttpMethod,
671 path: PathInput,
672 handler:
673 | HttpServerResponse.HttpServerResponse
674 | Effect.Effect<HttpServerResponse.HttpServerResponse, E, R>
675 | ((request: HttpServerRequest.HttpServerRequest) => Effect.Effect<HttpServerResponse.HttpServerResponse, E, R>),
676 options?: {
677 readonly uninterruptible?: boolean | undefined
678 }

Callers 1

HttpRouter.tsFile · 0.85

Calls 2

makeRouteFunction · 0.85
succeedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…