Cherry.Serve.Names (cherry v0.4.1)

Copy Markdown View Source

Optional named local URLs for serve, via a running cherrypicker daemon: cherry serve --name mysite registers the bound port and the site answers at http://mysite.localhost[:proxy port].

Deliberately stdlib-only (:httpc + the daemon's tiny control API) rather than a dependency: no daemon running is the common case, and it must cost nothing. :error here always means "fall back to the port URL", never a failed serve.

Summary

Functions

Registers name127.0.0.1:port with a local cherrypicker daemon.

Functions

register(name, port)

@spec register(String.t(), :inet.port_number()) :: {:ok, String.t()} | :error

Registers name127.0.0.1:port with a local cherrypicker daemon.

Returns the named URL, or :error when no daemon is reachable or the daemon refuses the name (a diagnostic is printed for that case — the author asked for a name and should learn why it did not take).