1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-08-31 19:37:00 +02:00

add README example/multipart

This commit is contained in:
ami44
2017-12-30 16:09:39 +01:00
parent d7d9e8c0e9
commit a1a77600c6
3 changed files with 32 additions and 3 deletions

View File

@@ -9,6 +9,8 @@ use actix_web::*;
use futures::{Future, Stream};
use futures::future::{result, Either};
use actix::Arbiter;
use actix::actors::signal::{ProcessSignals, Subscribe};
fn index(mut req: HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>>
{
@@ -46,13 +48,16 @@ fn main() {
let _ = env_logger::init();
let sys = actix::System::new("multipart-example");
HttpServer::new(
let addr = HttpServer::new(
|| Application::new()
.middleware(middleware::Logger::default()) // <- logger
.resource("/multipart", |r| r.method(Method::POST).a(index)))
.bind("127.0.0.1:8080").unwrap()
.start();
let signals = Arbiter::system_registry().get::<ProcessSignals>();
signals.send(Subscribe(addr.subscriber()));
println!("Starting http server: 127.0.0.1:8080");
let _ = sys.run();
}