Skip to content

struct

Config

pub struct Config {
    pub port: u16,
    pub root: PathBuf,
    pub spa: bool,
}

How to serve: the port, the directory, and whether unknown paths get index.html.

Fields

port

pub port: u16

The port to listen on.

root

pub root: PathBuf

The directory to serve.

spa

pub spa: bool

Serve index.html for unknown extensionless paths.

Methods

from_args

pub fn from_args(args: &[String], env: impl Fn(&str) -> Option<String>) -> Result<Config, String>

Defaults ← PORT / WEFT_ROOT env ← --port / --root / --no-spa.

Trait implementations