From 89c9dfb5bc0f06107f6f94a70c85b63fef4bd810 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Mon, 25 Dec 2017 08:19:33 -0800 Subject: [PATCH] update getting started guide section --- guide/src/qs_2.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/guide/src/qs_2.md b/guide/src/qs_2.md index a3b9e8155..c42eaac1c 100644 --- a/guide/src/qs_2.md +++ b/guide/src/qs_2.md @@ -48,9 +48,8 @@ request handler with the application's `resource` on a particular *HTTP method* # "Hello world!" # } # fn main() { - let app = Application::new() - .resource("/", |r| r.f(index)) - .finish(); + Application::new() + .resource("/", |r| r.f(index)); # } ``` @@ -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: ```rust,ignore - HttpServer::new(|| app) + HttpServer::new( + || Application::new() + .resource("/", |r| r.f(index))) .bind("127.0.0.1:8088")? .start(); ``` @@ -83,7 +84,7 @@ fn main() { HttpServer::new( || Application::new() .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(); println!("Started http server: 127.0.0.1:8088");