feat: improve logging, solve lints, improve implementations, remove unused code, standardize things

This commit is contained in:
2025-08-27 12:13:09 -05:00
parent 9972357cf6
commit ac70306c04
10 changed files with 168 additions and 121 deletions

View File

@@ -3,6 +3,7 @@
use axum::{Router, extract::State, response::Json, routing::get};
use serde_json::{Value, json};
use std::sync::Arc;
use tracing::{debug, info};
/// Shared application state for web server
#[derive(Clone)]
@@ -15,6 +16,7 @@ pub struct BannerState {
pub fn create_banner_router(state: BannerState) -> Router {
Router::new()
.route("/", get(root))
.route("/health", get(health))
.route("/status", get(status))
.route("/metrics", get(metrics))
.with_state(state)
@@ -22,6 +24,7 @@ pub fn create_banner_router(state: BannerState) -> Router {
/// Root endpoint - shows API info
async fn root() -> Json<Value> {
debug!("root endpoint accessed");
Json(json!({
"message": "Banner Discord Bot API",
"version": "0.1.0",
@@ -33,6 +36,15 @@ async fn root() -> Json<Value> {
}))
}
/// Health check endpoint
async fn health() -> Json<Value> {
info!("health check requested");
Json(json!({
"status": "healthy",
"timestamp": chrono::Utc::now().to_rfc3339()
}))
}
/// Status endpoint showing bot and system status
async fn status(State(_state): State<BannerState>) -> Json<Value> {
// For now, return basic status without accessing private fields