finished logging chapter

This commit is contained in:
Andre Heber
2024-02-19 11:12:46 +01:00
parent a0aa12872d
commit 39b6e11885
9 changed files with 317 additions and 30 deletions

View File

@ -1,6 +1,7 @@
use actix_web::dev::Server;
use actix_web::{web, App, HttpServer};
use sqlx::{Pool, Postgres};
use tracing_actix_web::TracingLogger;
use std::net::TcpListener;
use crate::routes::{health_check, subscribe};
@ -9,6 +10,7 @@ pub fn run(listener: TcpListener, connection_pool: Pool<Postgres>) -> Result<Ser
let connection_pool = web::Data::new(connection_pool);
let server = HttpServer::new(move || {
App::new()
.wrap(TracingLogger::default())
.route("/health_check", web::get().to(health_check))
.route("/subscriptions", web::post().to(subscribe))
.app_data(connection_pool.clone())