mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2025-12-06 15:15:36 +01:00
Move to sqlx
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use axum::{
|
||||
http::{self, Request, StatusCode},
|
||||
middleware::{self, Next},
|
||||
@@ -8,10 +6,11 @@ use axum::{
|
||||
Extension, Router,
|
||||
};
|
||||
use axum_prometheus::PrometheusMetricLayer;
|
||||
use sqlx::PgPool;
|
||||
use tower_http::trace::{self, TraceLayer};
|
||||
use tracing::Level;
|
||||
|
||||
use crate::{config::CONFIG, db::get_prisma_client, prisma::PrismaClient};
|
||||
use crate::{config::CONFIG, db::get_postgres_pool};
|
||||
|
||||
use self::translators::get_translators_router;
|
||||
use self::{
|
||||
@@ -26,7 +25,7 @@ pub mod genres;
|
||||
pub mod sequences;
|
||||
pub mod translators;
|
||||
|
||||
pub type Database = Extension<Arc<PrismaClient>>;
|
||||
pub type Database = Extension<PgPool>;
|
||||
|
||||
async fn auth(req: Request<axum::body::Body>, next: Next) -> Result<Response, StatusCode> {
|
||||
let auth_header = req
|
||||
@@ -48,7 +47,7 @@ async fn auth(req: Request<axum::body::Body>, next: Next) -> Result<Response, St
|
||||
}
|
||||
|
||||
pub async fn get_router() -> Router {
|
||||
let client = Arc::new(get_prisma_client().await);
|
||||
let client = get_postgres_pool().await;
|
||||
|
||||
let (prometheus_layer, metric_handle) = PrometheusMetricLayer::pair();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user