use rustapi_rs::prelude::*;
use tokio::signal;
#[derive(Debug, Serialize, Schema)]
struct PingResponse {
status: &'static str,
}
#[rustapi_rs::get("/api/v1/ping")]
#[rustapi_rs::tag("public")]
#[rustapi_rs::summary("Ping - golden path app check")]
async fn ping() -> Json<PingResponse> {
Json(PingResponse { status: "ok" })
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
tracing_subscriber::fmt::init();
RustApi::auto()
.production_defaults("golden-path")
.on_shutdown(|| async {
tracing::info!("graceful shutdown complete");
})
.run_with_shutdown("127.0.0.1:8080", async {
signal::ctrl_c().await.ok();
})
.await
}