mirror of
https://github.com/actix/examples
synced 2025-06-26 17:17:42 +02:00
normalize ports to 8080
This commit is contained in:
@ -5,6 +5,8 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "4"
|
||||
derive_more = "0.99.2"
|
||||
rand = "0.8"
|
||||
|
||||
derive_more = "0.99.5"
|
||||
env_logger = "0.9"
|
||||
log = "0.4"
|
||||
rand = "0.8"
|
||||
|
@ -89,13 +89,15 @@ async fn do_something() -> Result<HttpResponse, Error> {
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
std::env::set_var("RUST_LOG", "actix_web=info");
|
||||
env_logger::init();
|
||||
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||
|
||||
log::info!("starting HTTP server at http://localhost:8080");
|
||||
|
||||
|
||||
HttpServer::new(move || {
|
||||
App::new().service(web::resource("/something").route(web::get().to(do_something)))
|
||||
})
|
||||
.bind("127.0.0.1:8088")?
|
||||
.bind(("127.0.0.1", 8080))?
|
||||
.run()
|
||||
.await
|
||||
}
|
||||
|
Reference in New Issue
Block a user