Skip to main content

Module serve

Module serve 

Source
Expand description

litz serve: a static file server for a generated site.

A page that loads a wasm module or a firmware image cannot do so over file://, so this answers GET requests out of one directory with the right content types. It binds to loopback only: this is a development tool, and a directory server reachable from the network is a different product.

Nothing here is asynchronous. A visitor makes a handful of requests and then works inside the page, so a thread per connection costs less than the complexity of a runtime.

Constants§

DEFAULT_PORT

Functions§

serve
Serve root until the process is interrupted. port 0 asks the system to pick one, which is what the tests do.