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

Function makeRoute

packages/effect/src/unstable/http/HttpRouter.ts:644–655  ·  view source on GitHub ↗
(options: {
  readonly method: HttpMethod.HttpMethod | "*"
  readonly path: PathInput
  readonly handler: Effect.Effect<HttpServerResponse.HttpServerResponse, E, R>
  readonly uninterruptible?: boolean | undefined
  readonly prefix?: Option.Option<string> | string | undefined
})

Source from the content-addressed store, hash-verified

642}
643
644const makeRoute = <E, R>(options: {
645 readonly method: HttpMethod.HttpMethod | "*"
646 readonly path: PathInput
647 readonly handler: Effect.Effect<HttpServerResponse.HttpServerResponse, E, R>
648 readonly uninterruptible?: boolean | undefined
649 readonly prefix?: Option.Option<string> | string | undefined
650}): Route<E, Exclude<R, Provided>> => (({
651 ...options,
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.

Callers 4

addAllFunction · 0.85
prefixedFunction · 0.85
routeFunction · 0.85
HttpRouter.tsFile · 0.85

Calls 1

someMethod · 0.80

Tested by

no test coverage detected