server233 0.1.0

Practical Axum server foundations: API responses, errors, tracing, CORS, and shutdown
Documentation

server233

Practical Axum foundations for neko233 services.

  • consistent JSON API responses and errors
  • pagination type
  • standard tracing and CORS layers
  • graceful shutdown helper
use axum::{Router, routing::get};
use server233::{ApiResponse, default_cors, default_trace, serve, shutdown_signal};
use tokio::net::TcpListener;

# async fn example() -> std::io::Result<()> {
let app = Router::new()
    .route("/health", get(|| async { axum::Json(ApiResponse::ok("ok")) }))
    .layer(default_trace())
    .layer(default_cors());
let listener = TcpListener::bind("127.0.0.1:3000").await?;
serve(listener, app, shutdown_signal()).await
# }

Licensed under Apache-2.0.