BunHttpServer
Constructors
Layers
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>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;}