HttpApp
Combinators
Signature
declare function toHandled<E, R, _, EH, RH>(self: Default<E, R>, handleResponse: (request: HttpServerRequest, response: HttpServerResponse) => Effect<_, EH, RH>, middleware?: HttpMiddleware): Effect<void, never, HttpServerRequest | Exclude<R, Scope> | Exclude<RH, Scope>>Conversions
Since v1.0.0 Source
Signature
declare function fromWebHandler(handler: (request: Request) => Promise<Response>): Default<HttpServerError> Since v1.0.0 Source
Signature
declare const toWebHandler: <E>(self: Default<E, Scope.Scope>, middleware?: HttpMiddleware) => (request: Request, context?: Context.Context<never>) => Promise<Response> Since v1.0.0 Source
Signature
declare function toWebHandlerLayer<E, R, RE>(self: Default<E, Scope | R>, layer: Layer<R, RE>, options?: { readonly memoMap?: MemoMap; readonly middleware?: HttpMiddleware;}): { readonly dispose: () => Promise<void>; readonly handler: (request: Request, context?: Context<never>) => Promise<Response>;} Since v1.0.0 Source
Signature
declare function toWebHandlerLayerWith<E, R, RE, EX>(layer: Layer<R, RE>, options: { readonly memoMap?: MemoMap; readonly middleware?: HttpMiddleware; readonly toHandler: (runtime: Runtime<R>) => Effect<Effect<HttpServerResponse, E, Scope | HttpServerRequest | R>, EX>;}): { readonly dispose: () => Promise<void>; readonly handler: (request: Request, context?: Context<never>) => Promise<Response>;} Since v1.0.0 Source
Signature
declare function toWebHandlerRuntime<R>(runtime: Runtime<R>): <E>(self: Default<E, Scope | R>, middleware?: HttpMiddleware) => (request: Request, context?: Context<never>) => Promise<Response>Fiber Refs
Since v1.0.0 Source
Signature
declare const appendPreResponseHandler: (handler: PreResponseHandler) => Effect.Effect<void> Since v1.0.0 Source
Signature
declare const currentPreResponseHandlers: FiberRef.FiberRef<Option.Option<PreResponseHandler>> Since v1.0.0 Source
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>Models
Signature
type Default<E = never, R = never> = HttpApp<ServerResponse.HttpServerResponse, E, R>Signature
type HttpApp<A = ServerResponse.HttpServerResponse, E = never, R = never> = Effect.Effect<A, E, R | ServerRequest.HttpServerRequest>PreResponseHandler
type Since v1.0.0 Source
Signature
type PreResponseHandler = (request: ServerRequest.HttpServerRequest, response: ServerResponse.HttpServerResponse) => Effect.Effect<ServerResponse.HttpServerResponse, ServerError.ResponseError>Scope
Since v1.0.0 Source
If you want to finalize the http request scope elsewhere, you can use this function to eject from the default scope closure.
Signature
declare function ejectDefaultScopeClose(scope: Scope): void Since v1.0.0 Source
Signature
declare function unsafeEjectStreamScope(response: HttpServerResponse): HttpServerResponse