| 1 | use steid::{application::AppConfig, infrastructure}; |
| 2 | use topcoat::router::{Router, RouterBuilderDiscoverExt}; |
| 3 | |
| 4 | #[tokio::main] |
| 5 | async fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 6 | dotenvy::dotenv().ok(); |
| 7 | |
| 8 | let config = AppConfig::from_env()?; |
| 9 | let pool = infrastructure::database::connect(&config.database_url).await?; |
| 10 | |
| 11 | let router = Router::builder() |
| 12 | .discover() |
| 13 | .app_context(config) |
| 14 | .app_context(pool) |
| 15 | .build(); |
| 16 | |
| 17 | topcoat::start(router).await?; |
| 18 | |
| 19 | Ok(()) |
| 20 | } |