feat: implement surrealdb and redis

This commit is contained in:
Maulana Sodiqin
2025-02-25 02:00:19 +07:00
parent 9abab01b9c
commit 44de53a49d
18 changed files with 2501 additions and 137 deletions
+8 -9
View File
@@ -1,15 +1,14 @@
use axum::{routing::get, Router};
use v1::auth_router;
use crate::{AppState, RedisClient, SurrealClient};
use axum::{Extension, Router};
pub mod v1;
pub mod v2;
pub async fn apps() -> Router {
let v1_routes = Router::new()
.nest("/auth", auth_router())
.route("/", get(|| async { "Comming Soon v1" }));
pub async fn apps(surrealdb: SurrealClient, redisdb: RedisClient) -> Router {
let state = AppState { surrealdb, redisdb };
let v2_routes = Router::new().route("/", get(|| async { "Comming Soon v2" }));
Router::new().nest("/v1", v1_routes).nest("/v2", v2_routes)
Router::new()
.nest("/v1", v1::routes().await)
.nest("/v2", v2::routes().await)
.layer(Extension(state))
}