refactor: update AppState references to use state module
- Change all instances of AppState to reference the new state module across multiple files for consistency. - Clean up imports in auth, books, index_jobs, libraries, pages, search, settings, thumbnails, and tokens modules. - Simplify main.rs by removing unused code and organizing middleware and route handlers under the new handlers module.
This commit is contained in:
16
apps/indexer/src/api.rs
Normal file
16
apps/indexer/src/api.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
use axum::{extract::State, http::StatusCode, Json};
|
||||
use serde_json;
|
||||
|
||||
use crate::AppState;
|
||||
|
||||
pub async fn health() -> &'static str {
|
||||
"ok"
|
||||
}
|
||||
|
||||
pub async fn ready(State(state): State<AppState>) -> Result<Json<serde_json::Value>, StatusCode> {
|
||||
sqlx::query("SELECT 1")
|
||||
.execute(&state.pool)
|
||||
.await
|
||||
.map_err(|_| StatusCode::SERVICE_UNAVAILABLE)?;
|
||||
Ok(Json(serde_json::json!({"status": "ready"})))
|
||||
}
|
||||
Reference in New Issue
Block a user