Fix example on README.md

It was missing the actix-rt dependency. Also it's actix_rt::main, and not actix_web::main.
This commit is contained in:
tivrfoa 2020-06-27 11:26:06 -03:00 committed by GitHub
parent 487f90be5b
commit 2ba06d65a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -52,6 +52,7 @@ Dependencies:
```toml ```toml
[dependencies] [dependencies]
actix-rt = "1"
actix-web = "2" actix-web = "2"
``` ```
@ -65,7 +66,7 @@ async fn index(info: web::Path<(u32, String)>) -> impl Responder {
format!("Hello {}! id:{}", info.1, info.0) format!("Hello {}! id:{}", info.1, info.0)
} }
#[actix_web::main] #[actix_rt::main]
async fn main() -> std::io::Result<()> { async fn main() -> std::io::Result<()> {
HttpServer::new(|| App::new().service(index)) HttpServer::new(|| App::new().service(index))
.bind("127.0.0.1:8080")? .bind("127.0.0.1:8080")?