mirror of
https://github.com/actix/actix-extras.git
synced 2025-06-26 18:37:41 +02:00
update examples
This commit is contained in:
@ -5,7 +5,9 @@ extern crate env_logger;
|
||||
extern crate futures;
|
||||
|
||||
use actix::*;
|
||||
use actix_web::*;
|
||||
use actix_web::{
|
||||
http, middleware, multipart, server,
|
||||
Application, AsyncResponder, HttpRequest, HttpResponse, HttpMessage, Error};
|
||||
|
||||
use futures::{Future, Stream};
|
||||
use futures::future::{result, Either};
|
||||
@ -38,7 +40,7 @@ fn index(req: HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>>
|
||||
}
|
||||
})
|
||||
.finish() // <- Stream::finish() combinator from actix
|
||||
.map(|_| httpcodes::HTTPOk.into())
|
||||
.map(|_| HttpResponse::Ok().into())
|
||||
.responder()
|
||||
}
|
||||
|
||||
@ -47,10 +49,10 @@ fn main() {
|
||||
let _ = env_logger::init();
|
||||
let sys = actix::System::new("multipart-example");
|
||||
|
||||
let addr = HttpServer::new(
|
||||
let _ = server::new(
|
||||
|| Application::new()
|
||||
.middleware(middleware::Logger::default()) // <- logger
|
||||
.resource("/multipart", |r| r.method(Method::POST).a(index)))
|
||||
.resource("/multipart", |r| r.method(http::Method::POST).a(index)))
|
||||
.bind("127.0.0.1:8080").unwrap()
|
||||
.start();
|
||||
|
||||
|
Reference in New Issue
Block a user