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:
server.addr carries the resolved address
the moment serve() returns.
ServeOptions
TCP port to bind. Pass
0 to let the OS assign a free port (read it back from
server.addr.port).Interface to bind.
Abort to stop accepting connections and drain in-flight requests.
Called once the listener is bound, with the resolved
{ hostname, port }.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 a500and 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 ofserve().
meow:ui
On-brand status output for your programs and scripts.