serve_dir does not serve an index path
Open
design
- Dominant language
- Rust
- Stars
- 5.1k
- Forks
- 329
- PR merge metrics
- No merged PRs in 30d
Description
In order to serve an index file, the following is currently required:
```rust
let static_dir = PathBuf::from("/some/path");
app.at("/")
.get(|_| async { Ok(Body::from_file(static_dir.join("index.html")).await?) })
.serve_dir(static_dir)?;
```
Many uses of serve_dir would want to attach an index route, so either this pattern should be documented, or serve_dir/ServeDir should support the definition of an index route/file.
Contributor guide
Assessment
This issue has not been assessed yet.