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:
@ -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);
|
||||
|
@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user