Skip to main content Link Search Menu Expand Document (external link)

HttpApp.ts overview

Since v1.0.0


Exports Grouped by Category


combinators

toHandled

Signature

declare const toHandled: <E, R, _, EH, RH>(
  self: Default<E, R>,
  handleResponse: (
    request: ServerRequest.HttpServerRequest,
    response: ServerResponse.HttpServerResponse
  ) => Effect.Effect<_, EH, RH>,
  middleware?: HttpMiddleware | undefined
) => Effect.Effect<void, never, Exclude<R | RH | ServerRequest.HttpServerRequest, Scope.Scope>>

Source

Since v1.0.0

conversions

toWebHandler

Signature

declare const toWebHandler: <E>(
  self: Default<E, Scope.Scope>,
  middleware?: HttpMiddleware | undefined
) => (request: Request, context?: Context.Context<never> | undefined) => Promise<Response>

Source

Since v1.0.0

toWebHandlerLayer

Signature

declare const toWebHandlerLayer: <E, R, RE>(
  self: Default<E, R | Scope.Scope>,
  layer: Layer.Layer<R, RE>,
  middleware?: HttpMiddleware | undefined
) => {
  readonly close: () => Promise<void>
  readonly handler: (request: Request, context?: Context.Context<never> | undefined) => Promise<Response>
}

Source

Since v1.0.0

toWebHandlerRuntime

Signature

declare const toWebHandlerRuntime: <R>(
  runtime: Runtime.Runtime<R>
) => <E>(
  self: Default<E, R | Scope.Scope>,
  middleware?: HttpMiddleware | undefined
) => (request: Request, context?: Context.Context<never> | undefined) => Promise<Response>

Source

Since v1.0.0

fiber refs

appendPreResponseHandler

Signature

declare const appendPreResponseHandler: (handler: PreResponseHandler) => Effect.Effect<void>

Source

Since v1.0.0

currentPreResponseHandlers

Signature

declare const currentPreResponseHandlers: FiberRef.FiberRef<Option.Option<PreResponseHandler>>

Source

Since v1.0.0

withPreResponseHandler

Signature

declare const withPreResponseHandler: ((
  handler: PreResponseHandler
) => <A, E, R>(self: HttpApp<A, E, R>) => HttpApp<A, E, R>) &
  (<A, E, R>(self: HttpApp<A, E, R>, handler: PreResponseHandler) => HttpApp<A, E, R>)

Source

Since v1.0.0

models

Default (type alias)

Signature

type Default<E, R> = HttpApp<ServerResponse.HttpServerResponse, E, R>

Source

Since v1.0.0

HttpApp (type alias)

Signature

type HttpApp<A, E, R> = Effect.Effect<A, E, R | ServerRequest.HttpServerRequest>

Source

Since v1.0.0

PreResponseHandler (type alias)

Signature

type PreResponseHandler = (
  request: ServerRequest.HttpServerRequest,
  response: ServerResponse.HttpServerResponse
) => Effect.Effect<ServerResponse.HttpServerResponse, ServerError.ResponseError>

Source

Since v1.0.0