HttpApp.ts overview
Since v1.0.0
Exports Grouped by Category
Scope
ejectDefaultScopeClose
If you want to finalize the http request scope elsewhere, you can use this function to eject from the default scope closure.
Signature
declare const ejectDefaultScopeClose: (scope: Scope.Scope) => void
Since v1.0.0
unsafeEjectStreamScope
Signature
declare const unsafeEjectStreamScope: (response: ServerResponse.HttpServerResponse) => ServerResponse.HttpServerResponse
Since v1.0.0
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>>
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>
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>
}
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>
Since v1.0.0
fiber refs
appendPreResponseHandler
Signature
declare const appendPreResponseHandler: (handler: PreResponseHandler) => Effect.Effect<void>
Since v1.0.0
currentPreResponseHandlers
Signature
declare const currentPreResponseHandlers: FiberRef.FiberRef<Option.Option<PreResponseHandler>>
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>)
Since v1.0.0
models
Default (type alias)
Signature
type Default<E, R> = HttpApp<ServerResponse.HttpServerResponse, E, R>
Since v1.0.0
HttpApp (type alias)
Signature
type HttpApp<A, E, R> = Effect.Effect<A, E, R | ServerRequest.HttpServerRequest>
Since v1.0.0
PreResponseHandler (type alias)
Signature
type PreResponseHandler = (
request: ServerRequest.HttpServerRequest,
response: ServerResponse.HttpServerResponse
) => Effect.Effect<ServerResponse.HttpServerResponse, ServerError.ResponseError>
Since v1.0.0