http-rs / http-rs/tide

serve_dir does not serve an index path

Open
#604 3 comments 14 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.