mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-30 18:44:35 +01:00
simplify guide examples
This commit is contained in:
parent
bca1dd4f9e
commit
55534bff8c
@ -20,7 +20,7 @@ fn main() {
|
|||||||
|
|
||||||
HttpServer::new(
|
HttpServer::new(
|
||||||
|| Application::new()
|
|| Application::new()
|
||||||
.resource("/", |r| r.f(|_| httpcodes::HTTPOk)))
|
.resource("/", |r| r.h(httpcodes::HTTPOk)))
|
||||||
.bind("127.0.0.1:59080").unwrap()
|
.bind("127.0.0.1:59080").unwrap()
|
||||||
.start();
|
.start();
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ use actix_web::*;
|
|||||||
fn main() {
|
fn main() {
|
||||||
HttpServer::<TcpStream, SocketAddr, _, _>::new(
|
HttpServer::<TcpStream, SocketAddr, _, _>::new(
|
||||||
|| Application::new()
|
|| Application::new()
|
||||||
.resource("/", |r| r.f(|_| httpcodes::HTTPOk)))
|
.resource("/", |r| r.h(httpcodes::HTTPOk)))
|
||||||
.threads(4); // <- Start 4 workers
|
.threads(4); // <- Start 4 workers
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -109,7 +109,7 @@ use actix_web::*;
|
|||||||
fn main() {
|
fn main() {
|
||||||
HttpServer::<TcpStream, SocketAddr, _, _>::new(||
|
HttpServer::<TcpStream, SocketAddr, _, _>::new(||
|
||||||
Application::new()
|
Application::new()
|
||||||
.resource("/", |r| r.f(|r| httpcodes::HTTPOk)))
|
.resource("/", |r| r.h(httpcodes::HTTPOk)))
|
||||||
.keep_alive(None); // <- Use `SO_KEEPALIVE` socket option.
|
.keep_alive(None); // <- Use `SO_KEEPALIVE` socket option.
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user