mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-27 17:52:56 +01:00
fix examples
This commit is contained in:
parent
f0fdcc9936
commit
3768a2885d
@ -84,8 +84,7 @@ fn main() {
|
|||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
// static files
|
// static files
|
||||||
.resource("/static/{tail:.*}",
|
.handler("/static/", fs::StaticFiles::new("tail", "../static/", true))
|
||||||
|r| r.h(fs::StaticFiles::new("tail", "../static/", true)))
|
|
||||||
// redirect
|
// redirect
|
||||||
.resource("/", |r| r.method(Method::GET).f(|req| {
|
.resource("/", |r| r.method(Method::GET).f(|req| {
|
||||||
println!("{:?}", req);
|
println!("{:?}", req);
|
||||||
|
@ -210,8 +210,7 @@ fn main() {
|
|||||||
// websocket
|
// websocket
|
||||||
.resource("/ws/", |r| r.route().f(chat_route))
|
.resource("/ws/", |r| r.route().f(chat_route))
|
||||||
// static resources
|
// static resources
|
||||||
.resource("/static/{tail:.*}",
|
.handler("/static/", fs::StaticFiles::new("static/", true))
|
||||||
|r| r.h(fs::StaticFiles::new("tail", "static/", true)))
|
|
||||||
})
|
})
|
||||||
.bind("127.0.0.1:8080").unwrap()
|
.bind("127.0.0.1:8080").unwrap()
|
||||||
.start();
|
.start();
|
||||||
|
@ -68,8 +68,7 @@ fn main() {
|
|||||||
// websocket route
|
// websocket route
|
||||||
.resource("/ws/", |r| r.method(Method::GET).f(ws_index))
|
.resource("/ws/", |r| r.method(Method::GET).f(ws_index))
|
||||||
// static files
|
// static files
|
||||||
.resource("/{tail:.*}",
|
.handler("/", fs::StaticFiles::new("../static/", true)))
|
||||||
|r| r.h(fs::StaticFiles::new("tail", "../static/", true))))
|
|
||||||
// start http server on 127.0.0.1:8080
|
// start http server on 127.0.0.1:8080
|
||||||
.bind("127.0.0.1:8080").unwrap()
|
.bind("127.0.0.1:8080").unwrap()
|
||||||
.start();
|
.start();
|
||||||
|
Loading…
Reference in New Issue
Block a user