Skip to main content Link Search Menu Expand Document (external link)

BunHttpServer.ts overview

Since v1.0.0


Exports Grouped by Category


Options

ServeOptions (type alias)

Signature

type ServeOptions<R> = (
  | Omit<Bun.ServeOptions, "fetch" | "error">
  | Bun.TLSServeOptions
  | Bun.UnixServeOptions
  | Bun.UnixTLSServeOptions
) & { readonly routes?: R }

Source

Since v1.0.0

constructors

make

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>

Source

Since v1.0.0

layers

layer

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>

Source

Since v1.0.0

layerConfig

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
>

Source

Since v1.0.0

layerContext

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, never, never>

Source

Since v1.0.0

layerServer

Signature

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

Source

Since v1.0.0

layerTest

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<
  Server.HttpServer | Platform.HttpPlatform | Etag.Generator | BunContext.BunContext | HttpClient.HttpClient,
  HttpServerError.ServeError,
  never
>

Source

Since v1.0.0