Module core

Types

StrPair = tuple[k, v: string]
  Source Edit
Context = object
  position*: int
  accept*: bool
  log*: ref string
  headers*: List[StrPair]
  Source Edit
Handler = proc (req: ref Request; ctx: Context): Future[Context]
  Source Edit

Procs

proc reject(ctx: Context): Context {.
raises: [], tags: []
.}
  Source Edit
proc addPosition(ctx: Context; n: int): Context {.
raises: [], tags: []
.}
  Source Edit
proc withPosition(ctx: Context; n: int): Context {.
raises: [], tags: []
.}
  Source Edit
proc withLogging(ctx: Context; s: ref string): Context {.
raises: [], tags: []
.}
  Source Edit
proc withHeaders(ctx: Context; hs: openArray[StrPair]): Context {.
raises: [], tags: []
.}
  Source Edit
proc handle(h: Handler): auto {.
raises: [], tags: []
.}
  Source Edit
proc `~`(h1, h2: Handler): Handler {.
raises: [], tags: []
.}
  Source Edit
proc `->`(h1, h2: Handler): Handler {.
raises: [], tags: []
.}
  Source Edit
proc serve(server: AsyncHttpServer; port: Port; handler: Handler; address = ""): Future[
    void] {.
raises: [FutureError], tags: [WriteIOEffect, ReadIOEffect, RootEffect]
.}
  Source Edit

Iterators

iterator items[A](list: List[A]): A
  Source Edit

Templates

template `[]`(h1, h2: Handler): auto
  Source Edit