refactor: split http layer
This commit is contained in:
@@ -2,16 +2,16 @@
|
||||
#![deny(clippy::all, clippy::pedantic, clippy::nursery, clippy::cargo)]
|
||||
#![allow(clippy::missing_errors_doc, clippy::multiple_crate_versions)]
|
||||
|
||||
use pokedex_api::{app, config::AppConfig, telemetry};
|
||||
use pokedex_api::{config::AppConfig, http, telemetry};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
telemetry::init_tracing();
|
||||
let config = AppConfig::from_env()?;
|
||||
let listener = tokio::net::TcpListener::bind(config.bind_addr).await?;
|
||||
let state = app::AppState::from_config(&config)?;
|
||||
let state = http::AppState::from_config(&config)?;
|
||||
|
||||
axum::serve(listener, app::create_app(state))
|
||||
axum::serve(listener, http::create_app(state))
|
||||
.with_graceful_shutdown(shutdown_signal())
|
||||
.await?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user