mirror of
https://github.com/Xevion/banner.git
synced 2025-12-15 04:11:11 -06:00
feat: improve logging, solve lints, improve implementations, remove unused code, standardize things
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user