mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
update getting started guide section
This commit is contained in:
parent
a578262f73
commit
89c9dfb5bc
@ -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");
|
||||||
|
Loading…
Reference in New Issue
Block a user