mirror of
https://github.com/actix/actix-web.git
synced 2025-01-31 03:18:07 +00:00
fix examples
This commit is contained in:
parent
f0fdcc9936
commit
3768a2885d
3 changed files with 3 additions and 6 deletions
|
@ -84,8 +84,7 @@ fn main() {
|
|||
}
|
||||
}))
|
||||
// static files
|
||||
.resource("/static/{tail:.*}",
|
||||
|r| r.h(fs::StaticFiles::new("tail", "../static/", true)))
|
||||
.handler("/static/", fs::StaticFiles::new("tail", "../static/", true))
|
||||
// redirect
|
||||
.resource("/", |r| r.method(Method::GET).f(|req| {
|
||||
println!("{:?}", req);
|
||||
|
|
|
@ -210,8 +210,7 @@ fn main() {
|
|||
// websocket
|
||||
.resource("/ws/", |r| r.route().f(chat_route))
|
||||
// static resources
|
||||
.resource("/static/{tail:.*}",
|
||||
|r| r.h(fs::StaticFiles::new("tail", "static/", true)))
|
||||
.handler("/static/", fs::StaticFiles::new("static/", true))
|
||||
})
|
||||
.bind("127.0.0.1:8080").unwrap()
|
||||
.start();
|
||||
|
|
|
@ -68,8 +68,7 @@ fn main() {
|
|||
// websocket route
|
||||
.resource("/ws/", |r| r.method(Method::GET).f(ws_index))
|
||||
// static files
|
||||
.resource("/{tail:.*}",
|
||||
|r| r.h(fs::StaticFiles::new("tail", "../static/", true))))
|
||||
.handler("/", fs::StaticFiles::new("../static/", true)))
|
||||
// start http server on 127.0.0.1:8080
|
||||
.bind("127.0.0.1:8080").unwrap()
|
||||
.start();
|
||||
|
|
Loading…
Reference in a new issue