1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 06:39:22 +02:00

fix static files

This commit is contained in:
Nikolay Kim
2017-12-08 12:29:28 -08:00
parent 774bfc0a86
commit 3e91b06241
5 changed files with 35 additions and 16 deletions

View File

@ -80,7 +80,8 @@ fn main() {
}
}))
// static files
.resource("/static", |r| r.h(fs::StaticFiles::new("examples/static/", true)))
.resource("/static/{tail:.*}",
|r| r.h(fs::StaticFiles::new("tail", "examples/static/", true)))
// redirect
.resource("/", |r| r.method(Method::GET).f(|req| {
println!("{:?}", req);

View File

@ -67,7 +67,8 @@ fn main() {
// websocket route
.resource("/ws/", |r| r.method(Method::GET).f(ws_index))
// static files
.resource("/", |r| r.h(fs::StaticFiles::new("examples/static/", true))))
.resource("/{tail:.*}",
|r| r.h(fs::StaticFiles::new("tail", "examples/static/", true))))
// start http server on 127.0.0.1:8080
.serve::<_, ()>("127.0.0.1:8080").unwrap();