steid

@jamesgill /

steid/src/main.rs
528 BCode·Blame·Raw
0d12f7dfeat: config from env and SQLite pool in app context1mo
1mod application;
2mod infrastructure;
3
4use application::AppConfig;
5use topcoat::router::{Router, RouterBuilderDiscoverExt};
e6f4874feat: topcoat skeleton serving a page1mo
6
7#[tokio::main]
0d12f7dfeat: config from env and SQLite pool in app context1mo
8async fn main() -> Result<(), Box<dyn std::error::Error>> {
9 dotenvy::dotenv().ok();
e6f4874feat: topcoat skeleton serving a page1mo
10
0d12f7dfeat: config from env and SQLite pool in app context1mo
11 let config = AppConfig::from_env()?;
12 let pool = infrastructure::database::connect(&config.database_url).await?;
13
14 let router = Router::builder()
15 .discover()
16 .app_context(config)
17 .app_context(pool)
18 .build();
19
20 topcoat::start(router).await?;
e6f4874feat: topcoat skeleton serving a page1mo
21
0d12f7dfeat: config from env and SQLite pool in app context1mo
22 Ok(())
1111df1feat: init1mo
23}