1
0
mirror of https://github.com/actix/examples synced 2025-06-28 18:00:37 +02:00

upgrade actix-web to 0.6

This commit is contained in:
Nikolay Kim
2018-05-08 11:08:43 -07:00
parent 27de52b5d5
commit bbeb262a5c
55 changed files with 689 additions and 518 deletions

View File

@ -7,4 +7,4 @@ workspace = "../"
[dependencies]
env_logger = "0.5"
actix = "0.5"
actix-web = "^0.5"
actix-web = "^0.6"

View File

@ -2,8 +2,7 @@ extern crate actix;
extern crate actix_web;
extern crate env_logger;
use actix_web::{App, HttpRequest, server, middleware};
use actix_web::{middleware, server, App, HttpRequest};
fn index(_req: HttpRequest) -> &'static str {
"Hello world!"
@ -14,13 +13,14 @@ fn main() {
env_logger::init();
let sys = actix::System::new("hello-world");
server::new(
|| App::new()
server::new(|| {
App::new()
// enable logger
.middleware(middleware::Logger::default())
.resource("/index.html", |r| r.f(|_| "Hello world!"))
.resource("/", |r| r.f(index)))
.bind("127.0.0.1:8080").unwrap()
.resource("/", |r| r.f(index))
}).bind("127.0.0.1:8080")
.unwrap()
.start();
println!("Started http server: 127.0.0.1:8080");