Skip to main content

Crate webadev

Crate webadev 

Source
Expand description

A web dev server with live reload. Usable as a CLI or as a library.

The HTTP server (Config, Server, bind, serve) is behind the serve feature, enabled by default. Disable it to use only the watcher (watch and ReloadType).

See the README for features, CLI, and library usage.

Structs§

Config
Configuration for the server
Server
A bound server, ready to run. run starts serving only when awaited, so the url can be shown first.

Enums§

ReloadType
How to reload a browser tab on file change

Functions§

bind
Bind to config.ip:config.port and build the router. Returns the url, the bound listener and the router. Use 0 as config.port to let the OS pick a free port (the real one is in the url).
serve
Serve files from the already-bound listener with the given router, with live-reload over SSE.
watch
Run a background thread and watch a directory. When files change: