Add managed Alpaca pool
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
use crate::pool::AlpacaPool;
|
||||
use crate::pool::{alpaca::AlpacaPool, postgres::PostgresPool};
|
||||
use axum::{
|
||||
routing::{delete, get, post},
|
||||
Extension, Router, Server,
|
||||
};
|
||||
use log::info;
|
||||
use sqlx::PgPool;
|
||||
use std::net::SocketAddr;
|
||||
|
||||
pub mod assets;
|
||||
|
||||
pub async fn initialize_api(
|
||||
database_pool: PgPool,
|
||||
pub async fn run_api(
|
||||
postgres_pool: PostgresPool,
|
||||
alpaca_pool: AlpacaPool,
|
||||
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
let app = Router::new()
|
||||
@@ -19,7 +18,7 @@ pub async fn initialize_api(
|
||||
.route("/assets", post(assets::add_asset))
|
||||
.route("/assets/:symbol", post(assets::update_asset))
|
||||
.route("/assets/:symbol", delete(assets::delete_asset))
|
||||
.layer(Extension(database_pool))
|
||||
.layer(Extension(postgres_pool))
|
||||
.layer(Extension(alpaca_pool));
|
||||
|
||||
let addr = SocketAddr::from(([0, 0, 0, 0], 7878));
|
||||
|
Reference in New Issue
Block a user