1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-23 16:21:06 +01:00

add startup logging to basic example

This commit is contained in:
Rob Ede 2023-08-01 18:06:59 +01:00
parent 75a97f6b32
commit 605cd7c540
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933

View File

@ -1,5 +1,3 @@
#![allow(clippy::uninlined_format_args)]
use actix_web::{get, middleware, web, App, HttpRequest, HttpResponse, HttpServer}; use actix_web::{get, middleware, web, App, HttpRequest, HttpResponse, HttpServer};
#[get("/resource1/{name}/index.html")] #[get("/resource1/{name}/index.html")]
@ -22,6 +20,8 @@ async fn no_params() -> &'static str {
async fn main() -> std::io::Result<()> { async fn main() -> std::io::Result<()> {
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
log::info!("starting HTTP server at http://localhost:8080");
HttpServer::new(|| { HttpServer::new(|| {
App::new() App::new()
.wrap(middleware::DefaultHeaders::new().add(("X-Version", "0.2"))) .wrap(middleware::DefaultHeaders::new().add(("X-Version", "0.2")))