1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-10-21 17:33:59 +00:00

update getting started guide section

This commit is contained in:
Nikolay Kim 2017-12-25 08:19:33 -08:00
parent a578262f73
commit 89c9dfb5bc

View file

@ -48,9 +48,8 @@ request handler with the application's `resource` on a particular *HTTP method*
# "Hello world!" # "Hello world!"
# } # }
# fn main() { # fn main() {
let app = Application::new() Application::new()
.resource("/", |r| r.f(index)) .resource("/", |r| r.f(index));
.finish();
# } # }
``` ```
@ -58,7 +57,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) HttpServer::new(
|| Application::new()
.resource("/", |r| r.f(index)))
.bind("127.0.0.1:8088")? .bind("127.0.0.1:8088")?
.start(); .start();
``` ```
@ -83,7 +84,7 @@ fn main() {
HttpServer::new( HttpServer::new(
|| Application::new() || Application::new()
.resource("/", |r| r.f(index))) .resource("/", |r| r.f(index)))
.bind("127.0.0.1:8088").unwrap() .bind("127.0.0.1:8088").expect("Can not bind to 127.0.0.1:8088")
.start(); .start();
println!("Started http server: 127.0.0.1:8088"); println!("Started http server: 127.0.0.1:8088");