1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-11-27 12:01:15 +00:00

simplify guide examples

This commit is contained in:
Nikolay Kim 2017-12-20 23:21:26 -08:00
parent bca1dd4f9e
commit 55534bff8c

View file

@ -20,7 +20,7 @@ fn main() {
HttpServer::new(
|| Application::new()
.resource("/", |r| r.f(|_| httpcodes::HTTPOk)))
.resource("/", |r| r.h(httpcodes::HTTPOk)))
.bind("127.0.0.1:59080").unwrap()
.start();
@ -46,7 +46,7 @@ use actix_web::*;
fn main() {
HttpServer::<TcpStream, SocketAddr, _, _>::new(
|| Application::new()
.resource("/", |r| r.f(|_| httpcodes::HTTPOk)))
.resource("/", |r| r.h(httpcodes::HTTPOk)))
.threads(4); // <- Start 4 workers
}
```
@ -109,7 +109,7 @@ use actix_web::*;
fn main() {
HttpServer::<TcpStream, SocketAddr, _, _>::new(||
Application::new()
.resource("/", |r| r.f(|r| httpcodes::HTTPOk)))
.resource("/", |r| r.h(httpcodes::HTTPOk)))
.keep_alive(None); // <- Use `SO_KEEPALIVE` socket option.
}
```