refactor: move API routes to api.rs and remove unused imports

Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-12 14:50:14 -03:00
parent afdecb6c51
commit 4c82c55f58
2 changed files with 15 additions and 25 deletions

View File

@@ -20,10 +20,6 @@ mod api;
mod docs;
pub use common::{ServerConfig, AppState, logging_middleware};
use api::item::{handle_list_items, handle_get_item, handle_post_item, handle_delete_item};
use api::item::{handle_get_content_latest, handle_get_content, handle_get_content_latest_raw, handle_get_content_raw};
use api::status::handle_status;
use docs::{handle_openapi, handle_swagger_ui};
pub fn mode_server(
_cmd: &mut Command,
@@ -63,16 +59,7 @@ async fn run_server(
args: Arc::new(args.clone()),
};
let app = Router::new()
.route("/status", get(handle_status))
.route("/item/", get(handle_list_items).put(handle_post_item))
.route("/item/:id", get(handle_get_item).delete(handle_delete_item))
.route("/content", get(handle_get_content_latest))
.route("/content/:id", get(handle_get_content))
.route("/content-raw", get(handle_get_content_latest_raw))
.route("/content-raw/:id", get(handle_get_content_raw))
.route("/openapi.json", get(handle_openapi))
.route("/swagger/", get(handle_swagger_ui))
let app = api::api_router()
.layer(axum::middleware::from_fn(logging_middleware))
.layer(
ServiceBuilder::new()