//! repo-gen-test application entry point
//!
//! Run: cargo run
//! Docs: http://127.0.0.1:8080/api-docs/swagger-ui

use kegani::prelude::*;

// Declare routes module so main.rs can use it directly
mod routes;

#[tokio::main]
async fn main() -> std::io::Result<()> {
    // Initialize logging
    tracing_subscriber::fmt()
        .with_env_filter(
            tracing_subscriber::EnvFilter::try_from_default_env()
                .unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("info")),
        )
        .init();

    tracing::info!("Starting {} server...", env!("CARGO_PKG_NAME"));
    tracing::info!("API Docs: http://127.0.0.1:8080/api-docs/swagger-ui");
    tracing::info!("ReDoc: http://127.0.0.1:8080/api-docs/redoc");

    App::new()
        .host("127.0.0.1")
        .port(8080)
        .configure(|cfg| {
            cfg.service(routes::health_scope());
        })
        .run()
        .await
}