spin-kitchensink
spin-kitchensink copied to clipboard
Static server should try to read `index.html` if asset is a directory
https://github.com/fermyon/spin-kitchensink/blob/b25fe9315617b58363aff069264b58b1e947b566/rust-static-assets/src/lib.rs#L25
I got this working by
fn read(path: &str) -> Result<Bytes> {
let path_obj = Path::new(path);
let mut file = if path_obj.is_dir() {
File::open(path_obj.join("index.html"))
.with_context(|| anyhow!("tried directory index {}", path))?
} else {
File::open(path).with_context(|| anyhow!("cannot open {}", path))?
};
...
}