mirror of
https://github.com/actix/actix-web.git
synced 2024-12-03 06:46:41 +00:00
Update qs_2.md
This commit is contained in:
parent
232aba2080
commit
b28ecbcf0c
1 changed files with 6 additions and 4 deletions
|
@ -71,7 +71,7 @@ Here is full source of main.rs file:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
# use std::thread;
|
# use std::thread;
|
||||||
# extern crate actix_web;
|
extern crate actix_web;
|
||||||
use actix_web::*;
|
use actix_web::*;
|
||||||
|
|
||||||
fn index(req: HttpRequest) -> &'static str {
|
fn index(req: HttpRequest) -> &'static str {
|
||||||
|
@ -79,14 +79,16 @@ fn index(req: HttpRequest) -> &'static str {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
# let child = thread::spawn(|| {
|
# // In the doctest suite we can't run blocking code - deliberately leak a thread
|
||||||
|
# // If copying this example in show-all mode make sure you skip the thread spawn
|
||||||
|
# // call.
|
||||||
|
# thread::spawn(|| {
|
||||||
HttpServer::new(
|
HttpServer::new(
|
||||||
|| Application::new()
|
|| Application::new()
|
||||||
.resource("/", |r| r.f(index)))
|
.resource("/", |r| r.f(index)))
|
||||||
.bind("127.0.0.1:8088").expect("Can not bind to 127.0.0.1:8088")
|
.bind("127.0.0.1:8088").expect("Can not bind to 127.0.0.1:8088")
|
||||||
.run();
|
.run();
|
||||||
});
|
# });
|
||||||
# child.join().expect("failed to join server thread");
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue