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

HttpApp overview

Added in v1.0.0


Table of contents


combinators

toHandled

Signature

export 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>>

Added in v1.0.0

conversions

toWebHandler

Signature

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

Added in v1.0.0

toWebHandlerLayer

Signature

export 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>
}

Added in v1.0.0

toWebHandlerRuntime

Signature

export 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>

Added in v1.0.0

fiber refs

appendPreResponseHandler

Signature

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

Added in v1.0.0

currentPreResponseHandlers

Signature

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

Added in v1.0.0

withPreResponseHandler

Signature

export declare const withPreResponseHandler: any

Added in v1.0.0

models

Default (type alias)

Signature

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

Added in v1.0.0

HttpApp (type alias)

Signature

export type HttpApp<A = ServerResponse.HttpServerResponse, E = never, R = never> = Effect.Effect<
  A,
  E,
  R | ServerRequest.HttpServerRequest
>

Added in v1.0.0

PreResponseHandler (type alias)

Signature

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

Added in v1.0.0