Skip to content

Commit

Permalink
Update examples and docs to use the new FileServer api
Browse files Browse the repository at this point in the history
  • Loading branch information
the10thWiz authored and SergioBenitez committed Jul 6, 2024
1 parent 1cfcbf5 commit 113b79c
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion core/lib/src/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ crate::export! {
///
/// #[launch]
/// fn rocket() -> _ {
/// rocket::build().mount("/", FileServer::from(relative!("static")))
/// rocket::build().mount("/", FileServer::new(relative!("static")))
/// }
/// ```
///
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/05-requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ async fn files(file: PathBuf) -> Option<NamedFile> {
fn rocket() -> _ {
rocket::build()
// serve files from `/www/static` at path `/public`
.mount("/public", FileServer::from("/www/static"))
.mount("/public", FileServer::new("/www/static"))
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/11-deploying.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ For any deployment, it's important to keep in mind:
#[launch]
fn rocket() -> _ {
rocket::build()
.mount("/", FileServer::from("./static"))
.mount("/", FileServer::new("./static"))
.attach(Template::fairing())
}
```
Expand Down
2 changes: 1 addition & 1 deletion examples/chat/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ fn rocket() -> _ {
rocket::build()
.manage(channel::<Message>(1024).0)
.mount("/", routes![post, events])
.mount("/", FileServer::from(relative!("static")))
.mount("/", FileServer::new(relative!("static")))
}
2 changes: 1 addition & 1 deletion examples/forms/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,5 @@ fn rocket() -> _ {
rocket::build()
.mount("/", routes![index, submit])
.attach(Template::fairing())
.mount("/", FileServer::from(relative!("/static")))
.mount("/", FileServer::new(relative!("/static")))
}
2 changes: 1 addition & 1 deletion examples/static-files/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ mod manual {
fn rocket() -> _ {
rocket::build()
.mount("/", rocket::routes![manual::second])
.mount("/", FileServer::from(relative!("static")))
.mount("/", FileServer::new(relative!("static")))
}
2 changes: 1 addition & 1 deletion examples/static-files/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fn test_icon_file() {

#[test]
fn test_invalid_path() {
test_query_file("/hidden", None, Status::PermanentRedirect);
test_query_file("/hidden", None, Status::TemporaryRedirect);
test_query_file("/thou_shalt_not_exist", None, Status::NotFound);
test_query_file("/thou/shalt/not/exist", None, Status::NotFound);
test_query_file("/thou/shalt/not/exist?a=b&c=d", None, Status::NotFound);
Expand Down
2 changes: 1 addition & 1 deletion examples/todo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ fn rocket() -> _ {
.attach(DbConn::fairing())
.attach(Template::fairing())
.attach(AdHoc::on_ignite("Run Migrations", run_migrations))
.mount("/", FileServer::from(relative!("static")))
.mount("/", FileServer::new(relative!("static")))
.mount("/", routes![index])
.mount("/todo", routes![new, toggle, delete])
}
2 changes: 1 addition & 1 deletion examples/upgrade/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ fn echo_raw(ws: ws::WebSocket) -> ws::Stream!['static] {
fn rocket() -> _ {
rocket::build()
.mount("/", routes![echo_channel, echo_stream, echo_raw])
.mount("/", FileServer::from(fs::relative!("static")))
.mount("/", FileServer::new(fs::relative!("static")))
}

0 comments on commit 113b79c

Please sign in to comment.