Skip to content

Commit f736ac8

Browse files
committed
Update examples and docs to use the new FileServer api
1 parent 4beb00d commit f736ac8

File tree

9 files changed

+9
-9
lines changed

9 files changed

+9
-9
lines changed

core/lib/src/fs/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ crate::export! {
3434
///
3535
/// #[launch]
3636
/// fn rocket() -> _ {
37-
/// rocket::build().mount("/", FileServer::from(relative!("static")))
37+
/// rocket::build().mount("/", FileServer::new(relative!("static")))
3838
/// }
3939
/// ```
4040
///

docs/guide/05-requests.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ async fn files(file: PathBuf) -> Option<NamedFile> {
169169
fn rocket() -> _ {
170170
rocket::build()
171171
// serve files from `/www/static` at path `/public`
172-
.mount("/public", FileServer::from("/www/static"))
172+
.mount("/public", FileServer::new("/www/static"))
173173
}
174174
```
175175

docs/guide/11-deploying.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ For any deployment, it's important to keep in mind:
4949
#[launch]
5050
fn rocket() -> _ {
5151
rocket::build()
52-
.mount("/", FileServer::from("./static"))
52+
.mount("/", FileServer::new("./static"))
5353
.attach(Template::fairing())
5454
}
5555
```

examples/chat/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@ fn rocket() -> _ {
5454
rocket::build()
5555
.manage(channel::<Message>(1024).0)
5656
.mount("/", routes![post, events])
57-
.mount("/", FileServer::from(relative!("static")))
57+
.mount("/", FileServer::new(relative!("static")))
5858
}

examples/forms/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,5 @@ fn rocket() -> _ {
9393
rocket::build()
9494
.mount("/", routes![index, submit])
9595
.attach(Template::fairing())
96-
.mount("/", FileServer::from(relative!("/static")))
96+
.mount("/", FileServer::new(relative!("/static")))
9797
}

examples/static-files/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ mod manual {
2323
fn rocket() -> _ {
2424
rocket::build()
2525
.mount("/", rocket::routes![manual::second])
26-
.mount("/", FileServer::from(relative!("static")))
26+
.mount("/", FileServer::new(relative!("static")))
2727
}

examples/static-files/src/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn test_icon_file() {
6363

6464
#[test]
6565
fn test_invalid_path() {
66-
test_query_file("/hidden", None, Status::PermanentRedirect);
66+
test_query_file("/hidden", None, Status::TemporaryRedirect);
6767
test_query_file("/thou_shalt_not_exist", None, Status::NotFound);
6868
test_query_file("/thou/shalt/not/exist", None, Status::NotFound);
6969
test_query_file("/thou/shalt/not/exist?a=b&c=d", None, Status::NotFound);

examples/todo/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fn rocket() -> _ {
110110
.attach(DbConn::fairing())
111111
.attach(Template::fairing())
112112
.attach(AdHoc::on_ignite("Run Migrations", run_migrations))
113-
.mount("/", FileServer::from(relative!("static")))
113+
.mount("/", FileServer::new(relative!("static")))
114114
.mount("/", routes![index])
115115
.mount("/todo", routes![new, toggle, delete])
116116
}

examples/upgrade/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ fn echo_raw(ws: ws::WebSocket) -> ws::Stream!['static] {
3939
fn rocket() -> _ {
4040
rocket::build()
4141
.mount("/", routes![echo_channel, echo_stream, echo_raw])
42-
.mount("/", FileServer::from(fs::relative!("static")))
42+
.mount("/", FileServer::new(fs::relative!("static")))
4343
}

0 commit comments

Comments
 (0)