Skip to content
Effect Days 2026 Get your ticket

BunHttpServer

7 exports Added in v1.0.0 Source

Constructors

make

Added in v1.0.0 Source

Signature

declare const make: <R extends { [K in keyof R]: Bun.RouterTypes.RouteValue<Extract<K, string>> } = {}>(options: ServeOptions<R>) => Effect.Effect<Server.HttpServer, never, Scope.Scope>

Layers

layer

Added in v1.0.0 Source

Signature

declare const layer: <R extends { [K in keyof R]: Bun.RouterTypes.RouteValue<Extract<K, string>> } = {}>(options: ServeOptions<R>) => Layer.Layer<Server.HttpServer | Platform.HttpPlatform | Etag.Generator | BunContext.BunContext>

layerConfig

Added in v1.0.0 Source

Signature

declare const layerConfig: <R extends { [K in keyof R]: Bun.RouterTypes.RouteValue<Extract<K, string>> } = {}>(options: Config.Config.Wrap<ServeOptions<R>>) => Layer.Layer<Server.HttpServer | Platform.HttpPlatform | Etag.Generator | BunContext.BunContext, ConfigError.ConfigError>

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<Platform.HttpPlatform | Etag.Generator | BunContext.BunContext>

layerServer

Added in v1.0.0 Source

Signature

declare const layerServer: <R extends { [K in keyof R]: Bun.RouterTypes.RouteValue<Extract<K, string>> } = {}>(options: ServeOptions<R>) => Layer.Layer<Server.HttpServer>

layerTest

Added in v1.0.0 Source

Layer starting a server on a random port and producing an HttpClient with prepended url of the running http server.

Signature

declare const layerTest: Layer.Layer<HttpClient.HttpClient | Server.HttpServer | Platform.HttpPlatform | Etag.Generator | BunContext.BunContext, HttpServerError.ServeError>

Options

ServeOptions type

Added in v1.0.0 Source

Signature

type ServeOptions<R extends { [K in keyof R]: Bun.RouterTypes.RouteValue<Extract<K, string>> }> = Omit<Bun.ServeOptions, "fetch" | "error"> | Bun.TLSServeOptions | Bun.UnixServeOptions | Bun.UnixTLSServeOptions & {
readonly routes?: R;
}