rebuild file structur + simple sqlite db endpoint
This commit is contained in:
@@ -2,11 +2,23 @@ use axum::{
|
||||
Router,
|
||||
};
|
||||
|
||||
pub mod rooms;
|
||||
pub mod inventory;
|
||||
use crate::rooms::routes::rooms_routes;
|
||||
|
||||
pub fn create_routes() -> Router {
|
||||
pub mod inventory;
|
||||
use crate::utils::db_pool::HotelPools;
|
||||
|
||||
pub fn create_router(hotel_pools: HotelPools) -> Router {
|
||||
Router::new()
|
||||
.nest("/inventory", inventory::inventory_routes())
|
||||
.nest("/rooms", rooms::rooms_routes())
|
||||
}
|
||||
.nest("/rooms", rooms_routes())
|
||||
.with_state(hotel_pools) // 👈 hotel_db is passed in as argument
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
pub fn create_router() -> Router {
|
||||
Router::new()
|
||||
.nest("/rooms", rooms_routes())
|
||||
//.nest("/inventory", inventory::inventory_routes)
|
||||
}
|
||||
*/
|
||||
@@ -1,15 +0,0 @@
|
||||
use axum::{
|
||||
routing::{get, //post
|
||||
},
|
||||
Router,
|
||||
};
|
||||
|
||||
pub fn rooms_routes() -> Router {
|
||||
|
||||
Router::new()
|
||||
.route("/", get(hi_rooms) )
|
||||
}
|
||||
|
||||
async fn hi_rooms() -> &'static str {
|
||||
"Hiii from room.rs route module"
|
||||
}
|
||||
Reference in New Issue
Block a user