implemented use of auth on single room endpoint
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
use axum::{
|
||||
routing::{get, //post
|
||||
},
|
||||
Router,
|
||||
};
|
||||
|
||||
pub fn inventory_routes() -> Router {
|
||||
|
||||
Router::new()
|
||||
.route("/", get(hi_inventory) )
|
||||
}
|
||||
|
||||
async fn hi_inventory() -> &'static str {
|
||||
"Hiii from inventory.rs route module"
|
||||
}
|
||||
@@ -7,19 +7,26 @@ use r2d2::{Pool};
|
||||
use crate::rooms::routes::rooms_routes;
|
||||
use crate::utils::routes::utils_routes;
|
||||
|
||||
pub mod inventory;
|
||||
|
||||
use crate::utils::db_pool::{AppState};
|
||||
|
||||
//TODO: add secret fomr dotenv here
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Function to build our main router
|
||||
that regroup all feature centered router
|
||||
|
||||
*/
|
||||
|
||||
pub fn create_router(state: AppState) -> Router {
|
||||
|
||||
Router::new()
|
||||
|
||||
.nest("/auth", utils_routes())
|
||||
.with_state(state) // 👈 hotel_db is passed in as argument
|
||||
|
||||
.nest("/auth", utils_routes().with_state(state.clone()))
|
||||
.nest("/rooms", rooms_routes().with_state(state.clone()))
|
||||
.with_state(state)
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user