2025-06-11 22:46:58 -04:00
|
|
|
use anyhow::Result;
|
2022-07-17 17:04:48 -04:00
|
|
|
|
2025-06-11 22:46:58 -04:00
|
|
|
mod db;
|
|
|
|
|
mod logging;
|
|
|
|
|
mod places;
|
|
|
|
|
mod server;
|
2022-07-17 17:04:48 -04:00
|
|
|
|
2023-04-01 23:16:36 -04:00
|
|
|
#[tokio::main]
|
2023-08-04 23:46:34 -04:00
|
|
|
async fn main() -> Result<()> {
|
2023-04-01 23:16:36 -04:00
|
|
|
dotenvy::dotenv().unwrap_or_default();
|
2025-06-11 22:46:58 -04:00
|
|
|
logging::setup()?;
|
2023-04-01 23:16:36 -04:00
|
|
|
|
2025-06-11 22:46:58 -04:00
|
|
|
let pool = db::pool().await?;
|
|
|
|
|
db::run_migrations(&pool).await?;
|
2023-04-01 23:16:36 -04:00
|
|
|
|
2025-06-11 22:46:58 -04:00
|
|
|
let places_repository = places::db_repository::DbPlacesRepository::new(pool);
|
|
|
|
|
let places_routes = places::routes::places_routes(places_repository);
|
2023-04-01 23:16:36 -04:00
|
|
|
|
2025-06-11 22:46:58 -04:00
|
|
|
server::serve(places_routes).await?;
|
2023-08-04 23:46:34 -04:00
|
|
|
|
|
|
|
|
Ok(())
|
2023-04-01 23:16:36 -04:00
|
|
|
}
|