Skip to main content
meow:http exposes a single function, serve(), that starts a Web-standard HTTP/1.1 server. Your handler receives a standard Request and returns a standard Response (or a promise of one) — the same objects you use with fetch.

serve()

Accepts either a handler-first or an options-only (Deno-style) form:
The listener binds synchronously, so server.addr carries the resolved address the moment serve() returns.

ServeOptions

number
default:"8000"
TCP port to bind. Pass 0 to let the OS assign a free port (read it back from server.addr.port).
string
default:"\"0.0.0.0\""
Interface to bind.
AbortSignal
Abort to stop accepting connections and drain in-flight requests.
(addr: NetAddr) => void
Called once the listener is bound, with the resolved { hostname, port }.
Handler
The per-request handler, when using the options-only form.

Server

Examples

Error handling

  • A handler that throws, or returns something other than a Response, yields a 500 and logs the failure — one bad request never takes down the server.
  • If the listener can’t bind — for example, the port is already in use — the error surfaces through server.finished (it rejects) rather than throwing out of serve().

meow:ui

On-brand status output for your programs and scripts.