altair_server/lib.rs
1//! Axum + tower-http convenience layer.
2//!
3//! Wraps an `axum::Router` with a sensible-default middleware stack
4//! (tracing, request-id propagation, request timeout), a built-in `/health`
5//! endpoint, and SIGINT/SIGTERM-aware graceful shutdown. The underlying
6//! `axum`, `tower`, and `tower-http` crates are re-exported at the crate
7//! root so consumers don't need to add them as separate dependencies.
8//!
9//! # Example
10//!
11//! ```no_run
12//! use altair_server::Server;
13//! use altair_server::axum::routing::get;
14//!
15//! # async fn run() -> altair_server::Result<()> {
16//! Server::builder()
17//! .bind_addr("0.0.0.0:3000")
18//! .route("/", get(|| async { "hello" }))
19//! .build()
20//! .await?
21//! .run()
22//! .await
23//! # }
24//! ```
25
26#![deny(missing_docs)]
27#![forbid(unsafe_code)]
28#![warn(clippy::pedantic)]
29#![allow(clippy::module_name_repetitions)]
30#![allow(clippy::missing_errors_doc)]
31
32mod builder;
33mod error;
34mod health;
35mod middleware;
36mod server;
37mod shutdown;
38
39pub mod prelude;
40
41pub use builder::ServerBuilder;
42pub use error::{Error, Result};
43pub use server::Server;
44pub use shutdown::shutdown_signal;
45
46// Re-exports for one-dep ergonomics
47pub use ::axum;
48pub use ::tower;
49pub use ::tower_http;