1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-30 18:34:36 +01:00

update guide examples

This commit is contained in:
Nikolay Kim 2017-12-19 18:44:17 -08:00
parent d0c01c2cdd
commit c47e2ccfee
2 changed files with 6 additions and 4 deletions

View File

@ -58,7 +58,9 @@ After that, application instance can be used with `HttpServer` to listen for inc
connections. Server accepts function that should return `HttpHandler` instance: connections. Server accepts function that should return `HttpHandler` instance:
```rust,ignore ```rust,ignore
HttpServer::new(|| app).serve::<_, ()>("127.0.0.1:8088"); HttpServer::new(|| app)
.bind("127.0.0.1:8088")?
.start();
``` ```
That's it. Now, compile and run the program with cargo run. That's it. Now, compile and run the program with cargo run.
@ -92,5 +94,5 @@ fn main() {
Note on `actix` crate. Actix web framework is built on top of actix actor library. Note on `actix` crate. Actix web framework is built on top of actix actor library.
`actix::System` initializes actor system, `HttpServer` is an actor and must run within `actix::System` initializes actor system, `HttpServer` is an actor and must run within
proper configured actix system. For more information please check properly configured actix system. For more information please check
[actix documentation](https://actix.github.io/actix/actix/) [actix documentation](https://actix.github.io/actix/actix/)

View File

@ -47,7 +47,7 @@ fn main() {
HttpServer::<TcpStream, SocketAddr, _, _>::new( HttpServer::<TcpStream, SocketAddr, _, _>::new(
|| Application::new() || Application::new()
.resource("/", |r| r.f(|_| httpcodes::HTTPOk))) .resource("/", |r| r.f(|_| httpcodes::HTTPOk)))
.threads(4); // <- Start 4 threads .threads(4); // <- Start 4 workers
} }
``` ```
@ -88,7 +88,7 @@ Note on *HTTP/2.0* protocol over tls without prior knowledge, it requires
`openssl` has `alpn ` support. `openssl` has `alpn ` support.
Please check [example](https://github.com/actix/actix-web/tree/master/examples/tls) Please check [example](https://github.com/actix/actix-web/tree/master/examples/tls)
for concrete example. for full example.
## Keep-Alive ## Keep-Alive