Skip to content
Effect Days 2026 Get your ticket

HttpServer

18 exports Added in v1.0.0 Source

Accessors

serve

Added in v1.0.0 Source

Signature

declare const serve: {
(): <E, R>(httpApp: Default<E, R>) => Layer<never, never, HttpServer | Exclude<R, Scope | HttpServerRequest>>;
<E, R, App extends Default<any, any>>(middleware: Applied<App, E, R>): (httpApp: Default<E, R>) => Layer<never, never, any>;
<E, R>(httpApp: Default<E, R>): Layer<never, never, HttpServer | Exclude<R, Scope | HttpServerRequest>>;
<E, R, App extends Default<any, any>>(httpApp: Default<E, R>, middleware: Applied<App, E, R>): Layer<never, never, any>;
}

serveEffect

Added in v1.0.0 Source

Signature

declare const serveEffect: {
(): <E, R>(httpApp: Default<E, R>) => Effect<void, never, Scope | HttpServer | Exclude<R, HttpServerRequest>>;
<E, R, App extends Default<any, any>>(middleware: Applied<App, E, R>): (httpApp: Default<E, R>) => Effect<void, never, any>;
<E, R>(httpApp: Default<E, R>): Effect<void, never, Scope | HttpServer | Exclude<R, HttpServerRequest>>;
<E, R, App extends Default<any, any>>(httpApp: Default<E, R>, middleware: Applied<App, E, R>): Effect<void, never, any>;
}

Address

Address type

Added in v1.0.0 Source

Signature

type Address = UnixAddress | TcpAddress

Signature

declare const addressFormattedWith: <A, E, R>(effect: (address: string) => Effect.Effect<A, E, R>) => Effect.Effect<A, E, HttpServer | R>

addressWith

Added in v1.0.0 Source

Signature

declare const addressWith: <A, E, R>(effect: (address: Address) => Effect.Effect<A, E, R>) => Effect.Effect<A, E, HttpServer | R>

Signature

declare const formatAddress: (address: Address) => string

logAddress

Added in v1.0.0 Source

Signature

declare const logAddress: Effect.Effect<void, never, HttpServer>

TcpAddress interface

Added in v1.0.0 Source

Signature

interface TcpAddress {
readonly _tag: "TcpAddress";
readonly hostname: string;
readonly port: number;
}

UnixAddress interface

Added in v1.0.0 Source

Signature

interface UnixAddress {
readonly _tag: "UnixAddress";
readonly path: string;
}

Signature

declare const withLogAddress: <A, E, R>(layer: Layer.Layer<A, E, R>) => Layer.Layer<A, E, R | Exclude<HttpServer, A>>

Constructors

HttpServer

Added in v1.0.0 Source

Signature

declare const HttpServer: Tag<HttpServer, HttpServer>

make

Added in v1.0.0 Source

Signature

declare const make: (options: {
readonly address: Address;
readonly serve: (httpApp: App.Default<unknown>, middleware?: Middleware.HttpMiddleware) => Effect.Effect<void, never, Scope.Scope>;
}) => HttpServer

Layers

layerContext

Added in v1.0.0 Source

A Layer providing the HttpPlatform, FileSystem, Etag.Generator, and Path services.

The FileSystem service is a no-op implementation, so this layer is only useful for platforms that have no file system.

Signature

declare const layerContext: Layer.Layer<HttpPlatform | FileSystem | Generator | Path>

Layer producing an HttpClient with prepended url of the running http server.

Signature

declare const layerTestClient: Layer.Layer<Client.HttpClient, never, Client.HttpClient | HttpServer>

Models

HttpServer interface

Added in v1.0.0 Source

Signature

interface HttpServer {
readonly [TypeId]: typeof TypeId;
readonly address: Address;
readonly serve: {
<E, R>(httpApp: Default<E, R>): Effect<void, never, Scope | Exclude<R, HttpServerRequest>>;
<E, R, App extends Default<any, any>>(httpApp: Default<E, R>, middleware: Applied<App, E, R>): Effect<void, never, Scope | Exclude<R, HttpServerRequest>>;
};
}

ServeOptions interface

Added in v1.0.0 Source

Signature

interface ServeOptions {
readonly respond: boolean;
}

Type Ids

TypeId

Added in v1.0.0 Source

Signature

declare const TypeId: unique symbol

TypeId type

Added in v1.0.0 Source

Signature

type TypeId = typeof TypeId