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

Server overview

Added in v1.0.0


Table of contents


accessors

serve

Signature

export declare const serve: {
  (): <R, E>(httpApp: App.Default<E, R>) => Layer.Layer<never, never, Server | Exclude<R, any>>
  <R, E, App extends App.Default<any, any>>(
    middleware: Middleware.Middleware.Applied<App, E, R>
  ): (httpApp: App.Default<E, R>) => Layer.Layer<never, never, Server>
  <R, E>(httpApp: App.Default<E, R>): Layer.Layer<never, never, Server | Exclude<R, any>>
  <R, E, App extends App.Default<any, any>>(
    httpApp: App.Default<E, R>,
    middleware: Middleware.Middleware.Applied<App, E, R>
  ): Layer.Layer<never, never, Server>
}

Added in v1.0.0

serveEffect

Signature

export declare const serveEffect: {
  (): <R, E>(httpApp: App.Default<E, R>) => Effect.Effect<void, never, any>
  <R, E, App extends App.Default<any, any>>(
    middleware: Middleware.Middleware.Applied<App, E, R>
  ): (httpApp: App.Default<E, R>) => Effect.Effect<void, never, any>
  <R, E>(httpApp: App.Default<E, R>): Effect.Effect<void, never, any>
  <R, E, App extends App.Default<any, any>>(
    httpApp: App.Default<E, R>,
    middleware: Middleware.Middleware.Applied<App, E, R>
  ): Effect.Effect<void, never, any>
}

Added in v1.0.0

address

Address (type alias)

Signature

export type Address = UnixAddress | TcpAddress

Added in v1.0.0

TcpAddress (interface)

Signature

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

Added in v1.0.0

UnixAddress (interface)

Signature

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

Added in v1.0.0

addressFormattedWith

Signature

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

Added in v1.0.0

addressWith

Signature

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

Added in v1.0.0

formatAddress

Signature

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

Added in v1.0.0

logAddress

Signature

export declare const logAddress: Effect.Effect<void, never, Server>

Added in v1.0.0

withLogAddress

Signature

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

Added in v1.0.0

constructors

Server

Signature

export declare const Server: Context.Tag<Server, Server>

Added in v1.0.0

make

Signature

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

Added in v1.0.0

models

ServeOptions (interface)

Signature

export interface ServeOptions {
  readonly respond: boolean
}

Added in v1.0.0

Server (interface)

Signature

export interface Server {
  readonly [TypeId]: TypeId
  readonly serve: {
    <R, E>(
      httpApp: App.Default<E, R>
    ): Effect.Effect<void, never, Exclude<R, ServerRequest.ServerRequest> | Scope.Scope>
    <R, E, App extends App.Default<any, any>>(
      httpApp: App.Default<E, R>,
      middleware: Middleware.Middleware.Applied<App, E, R>
    ): Effect.Effect<void, never, Exclude<R, ServerRequest.ServerRequest> | Scope.Scope>
  }
  readonly address: Address
}

Added in v1.0.0

type ids

TypeId

Signature

export declare const TypeId: typeof TypeId

Added in v1.0.0

TypeId (type alias)

Signature

export type TypeId = typeof TypeId

Added in v1.0.0