mirror of
https://github.com/fafhrd91/actix-web
synced 2025-01-18 05:41:50 +01:00
update examples
This commit is contained in:
parent
f73f97353b
commit
f2b3dc5625
@ -33,10 +33,12 @@ async fn index(info: web::Path<(u32, String)>) -> impl Responder {
|
||||
format!("Hello {}! id:{}", info.1, info.0)
|
||||
}
|
||||
|
||||
fn main() -> std::io::Result<()> {
|
||||
#[actix_rt::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
HttpServer::new(|| App::new().service(index))
|
||||
.bind("127.0.0.1:8080")?
|
||||
.run()
|
||||
.start()
|
||||
.await
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -16,7 +16,8 @@ async fn no_params() -> &'static str {
|
||||
"Hello world!\r\n"
|
||||
}
|
||||
|
||||
fn main() -> std::io::Result<()> {
|
||||
#[actix_rt::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
std::env::set_var("RUST_LOG", "actix_server=info,actix_web=info");
|
||||
env_logger::init();
|
||||
|
||||
@ -41,5 +42,6 @@ fn main() -> std::io::Result<()> {
|
||||
})
|
||||
.bind("127.0.0.1:8080")?
|
||||
.workers(1)
|
||||
.run()
|
||||
.start()
|
||||
.await
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
use actix_http::Error;
|
||||
use actix_rt::System;
|
||||
|
||||
fn main() -> Result<(), Error> {
|
||||
#[actix_rt::main]
|
||||
async fn main() -> Result<(), Error> {
|
||||
std::env::set_var("RUST_LOG", "actix_http=trace");
|
||||
env_logger::init();
|
||||
|
||||
System::new("test").block_on(async {
|
||||
let client = awc::Client::new();
|
||||
|
||||
// Create request builder, configure request and send
|
||||
@ -23,5 +22,4 @@ fn main() -> Result<(), Error> {
|
||||
println!("Downloaded: {:?} bytes", body.len());
|
||||
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
@ -19,7 +19,8 @@ async fn no_params() -> &'static str {
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
fn main() -> std::io::Result<()> {
|
||||
#[actix_rt::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
std::env::set_var("RUST_LOG", "actix_server=info,actix_web=info");
|
||||
env_logger::init();
|
||||
|
||||
@ -44,7 +45,8 @@ fn main() -> std::io::Result<()> {
|
||||
})
|
||||
.bind_uds("/Users/fafhrd91/uds-test")?
|
||||
.workers(1)
|
||||
.run()
|
||||
.start()
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(not(unix))]
|
||||
|
Loading…
x
Reference in New Issue
Block a user