Skip to content

Commit

Permalink
feat: harmonize request_id
Browse files Browse the repository at this point in the history
  • Loading branch information
Yag000 committed Aug 30, 2023
1 parent 76fa6f9 commit 004f835
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
33 changes: 33 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ tracing-bunyan-formatter = "0.3"
tracing-log = "0.1"
once_cell = "1"
secrecy = { version = "0.8", features = ["serde"] }
tracing-actix-web = "0.7"

[dev-dependencies]
reqwest = { version = "0.11", features = ["json"] }
1 change: 0 additions & 1 deletion src/routes/subscriptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ pub struct FormData {
name = "Adding a new subscriber",
skip(form, pool),
fields(
request_id = %Uuid::new_v4(),
subscriber_email = %form.email,
subscriber_name = %form.name,
)
Expand Down
5 changes: 3 additions & 2 deletions src/startup.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
use std::net::TcpListener;

use actix_web::{dev::Server, middleware::Logger, web, App, HttpServer};
use actix_web::{dev::Server, web, App, HttpServer};
use sqlx::PgPool;
use tracing_actix_web::TracingLogger;

use crate::routes::{health_check, subscribe};

pub fn run(listener: TcpListener, db_pool: PgPool) -> Result<Server, std::io::Error> {
let connection = web::Data::new(db_pool);
let server = HttpServer::new(move || {
App::new()
.wrap(Logger::default())
.wrap(TracingLogger::default())
.route("/health_check", web::get().to(health_check))
.route("/subscriptions", web::post().to(subscribe))
.app_data(connection.clone())
Expand Down

0 comments on commit 004f835

Please sign in to comment.