Skip to content

Commit

Permalink
Merge pull request #798 from mendelt/serve_file_example_clarification
Browse files Browse the repository at this point in the history
add a comment to the serve_file example to fix confusion mentioned in issue #796
  • Loading branch information
joshtriplett authored Nov 29, 2021
2 parents 4be9062 + 1b59bf7 commit 3ed28da
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/static_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ async fn main() -> Result<(), std::io::Error> {
let mut app = tide::new();
app.at("/").get(|_| async { Ok("visit /src/*") });
app.at("/src/*").serve_dir("src/")?;

// Make sure examples/static_file.html is available relative to the current-dir this example is run from or replace this with an absolute path.
app.at("/example").serve_file("examples/static_file.html")?;

app.listen("127.0.0.1:8080").await?;
Ok(())
}

0 comments on commit 3ed28da

Please sign in to comment.