insert subscription, db test isolation
This commit is contained in:
@ -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();
|
||||
|
||||
Reference in New Issue
Block a user