1
0
mirror of https://github.com/actix/actix-website synced 2025-03-15 20:53:07 +01:00

21 lines
451 B
Rust
Raw Normal View History

2019-06-17 16:57:57 -04:00
// <logger>
use actix_web::middleware::Logger;
use env_logger::Env;
2019-06-17 16:57:57 -04:00
2020-09-12 16:21:54 +01:00
#[actix_web::main]
2019-12-29 02:03:17 +09:00
async fn main() -> std::io::Result<()> {
2019-06-26 02:59:20 -04:00
use actix_web::{App, HttpServer};
2022-01-01 16:05:37 -06:00
env_logger::init_from_env(Env::default().default_filter_or("info"));
2019-06-17 16:57:57 -04:00
2019-06-26 02:59:20 -04:00
HttpServer::new(|| {
App::new()
.wrap(Logger::default())
.wrap(Logger::new("%a %{User-Agent}i"))
})
2022-02-26 03:56:24 +00:00
.bind(("127.0.0.1", 8080))?
2019-06-26 02:59:20 -04:00
.run()
2019-12-29 02:03:17 +09:00
.await
2019-06-17 16:57:57 -04:00
}
// </logger>