def server.start.valid

bend-kit-http@0.38.2.0 · http.bend:6323

import bend-kit-http@0.38.2.0/http.bend as Http
import Base

6323def server.start.valid(~C: Data, ~O: Type, valid: Bool, context: C, owner: O, +config: ServerConfig) -> IO(O & Result<&2, &1, StartupError, Server<C>>):
6324  match valid:
6325    case False{}:
6326      IO.pure(O & Result<&2, &1, StartupError, Server<C>>, (owner, Fail{InvalidConfig{}}))
6327    case True{}:
6328      ServerConfig{host, port, body, headers, connections, requests, buffered, header_ms, body_ms, idle_ms, write_ms} = config
6329      do IO<O & Result<&2, &1, StartupError, Server<C>>>:
6330        result : Result<&1, &1, U32 & String, Listener> <- TCP.listen(host, port)
6331        server.started(~C, ~O, context, owner, config, result)

Uses (15)

Used by (1)