diff --git a/examples/multipart/Cargo.toml b/examples/multipart/Cargo.toml index 03ab65294..049ca76c5 100644 --- a/examples/multipart/Cargo.toml +++ b/examples/multipart/Cargo.toml @@ -10,5 +10,5 @@ path = "src/main.rs" [dependencies] env_logger = "*" futures = "0.1" -actix = "^0.3.4" -actix-web = { git = "https://github.com/actix/actix-web.git" } +actix = "^0.3.5" +actix-web = { git = "https://github.com/actix/actix-web", features=["signal"] } diff --git a/examples/multipart/README.md b/examples/multipart/README.md new file mode 100644 index 000000000..348d28687 --- /dev/null +++ b/examples/multipart/README.md @@ -0,0 +1,24 @@ +# multipart + +Multipart's `Getting Started` guide for Actix web + +## Usage + +### server + +```bash +cd actix-web/examples/multipart +cargo run (or ``cargo watch -x run``) +# Started http server: 127.0.0.1:8080 +``` + +### client + +- ``pip install aiohttp`` +- ``python client.py`` +- you must see in server console multipart fields + +if ubuntu : + +- ``pip3 install aiohttp`` +- ``python3 client.py`` diff --git a/examples/multipart/src/main.rs b/examples/multipart/src/main.rs index 1af329c2f..51bf5799f 100644 --- a/examples/multipart/src/main.rs +++ b/examples/multipart/src/main.rs @@ -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> { @@ -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::(); + signals.send(Subscribe(addr.subscriber())); + println!("Starting http server: 127.0.0.1:8080"); let _ = sys.run(); }