server233
Practical Axum foundations for neko233 services.
- consistent JSON API responses and errors
- pagination type
- standard tracing and CORS layers
- graceful shutdown helper
use ;
use ;
use TcpListener;
# async
Licensed under Apache-2.0.
Practical Axum foundations for neko233 services.
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.