1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-23 23:51:06 +01:00

update examples

This commit is contained in:
Nikolay Kim 2017-12-07 18:08:16 -08:00
parent d595dd850e
commit 3f06439d3e
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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();