mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
update examples
This commit is contained in:
parent
d595dd850e
commit
3f06439d3e
@ -30,11 +30,11 @@ fn main() {
|
||||
let pkcs12 = Pkcs12::from_der(&pkcs12).unwrap().parse("12345").unwrap();
|
||||
|
||||
HttpServer::new(
|
||||
Application::default("/")
|
||||
Application::new("/")
|
||||
// enable logger
|
||||
.middleware(middlewares::Logger::default())
|
||||
// register simple handler, handle all methods
|
||||
.route("/index.html", |r| r.f(index))
|
||||
.resource("/index.html", |r| r.f(index))
|
||||
// with path parameters
|
||||
.resource("/", |r| r.method(Method::GET).f(|req| {
|
||||
httpcodes::HTTPFound
|
||||
|
@ -197,7 +197,7 @@ fn main() {
|
||||
|
||||
// Create Http server with websocket support
|
||||
HttpServer::new(
|
||||
Application::build("/", state)
|
||||
Application::with_state("/", state)
|
||||
// redirect to websocket.html
|
||||
.resource("/", |r| r.method(Method::GET).f(|req| {
|
||||
httpcodes::HTTPFound
|
||||
@ -208,7 +208,7 @@ fn main() {
|
||||
// websocket
|
||||
.resource("/ws/", |r| r.route().f(chat_route))
|
||||
// static resources
|
||||
.route("/static", |r| r.h(fs::StaticFiles::new("static/", true))))
|
||||
.resource("/static", |r| r.h(fs::StaticFiles::new("static/", true))))
|
||||
.serve::<_, ()>("127.0.0.1:8080").unwrap();
|
||||
|
||||
let _ = sys.run();
|
||||
|
Loading…
Reference in New Issue
Block a user