1
0
mirror of https://github.com/actix/examples synced 2025-01-23 14:24:35 +01:00

19 lines
490 B
Rust
Raw Normal View History

2019-04-09 14:12:07 -04:00
use actix_web::{middleware, App, HttpServer};
2022-02-18 02:02:44 +00:00
use nested_routing::app_config::config_app;
2019-04-09 14:12:07 -04:00
2020-09-12 16:49:45 +01:00
#[actix_web::main]
2019-12-07 23:59:24 +06:00
async fn main() -> std::io::Result<()> {
2022-12-30 16:30:16 +00:00
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
log::info!("starting HTTP server at http://localhost:8080");
2019-04-09 14:12:07 -04:00
2019-04-14 10:34:41 -07:00
HttpServer::new(|| {
2019-04-09 14:12:07 -04:00
App::new()
.configure(config_app)
.wrap(middleware::Logger::default())
2019-04-14 10:34:41 -07:00
})
2022-02-17 20:22:36 +00:00
.bind(("127.0.0.1", 8080))?
2019-12-25 20:48:33 +04:00
.run()
2019-12-07 23:59:24 +06:00
.await
2019-04-14 10:34:41 -07:00
}