insert subscription, db test isolation

This commit is contained in:
Andre Heber
2024-02-15 20:14:27 +01:00
parent bb94bde843
commit a0aa12872d
7 changed files with 90 additions and 41 deletions

View File

@ -5,13 +5,13 @@ use std::net::TcpListener;
use crate::routes::{health_check, subscribe};
pub fn run(listener: TcpListener, connection: Pool<Postgres>) -> Result<Server, std::io::Error> {
let connection = web::Data::new(connection);
pub fn run(listener: TcpListener, connection_pool: Pool<Postgres>) -> Result<Server, std::io::Error> {
let connection_pool = web::Data::new(connection_pool);
let server = HttpServer::new(move || {
App::new()
.route("/health_check", web::get().to(health_check))
.route("/subscriptions", web::post().to(subscribe))
.app_data(connection.clone())
.app_data(connection_pool.clone())
})
.listen(listener)?
.run();