refactor: Simplify server router merging with conditional compilation
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
@@ -56,7 +56,7 @@ use utoipa_swagger_ui::SwaggerUi;
|
||||
struct ApiDoc;
|
||||
|
||||
pub fn add_routes(router: Router<AppState>) -> Router<AppState> {
|
||||
router
|
||||
let mut router = router
|
||||
// Status endpoints
|
||||
.route("/api/status", get(status::handle_status))
|
||||
|
||||
@@ -65,11 +65,14 @@ pub fn add_routes(router: Router<AppState>) -> Router<AppState> {
|
||||
.route("/api/item/latest/meta", get(item::handle_get_item_latest_meta))
|
||||
.route("/api/item/latest/content", get(item::handle_get_item_latest_content))
|
||||
.route("/api/item/{item_id}/meta", get(item::handle_get_item_meta))
|
||||
.route("/api/item/{item_id}/content", get(item::handle_get_item_content))
|
||||
|
||||
// MCP endpoints
|
||||
#[cfg(feature = "mcp")]
|
||||
.route("/mcp/sse", get(mcp::handle_mcp_sse))
|
||||
.route("/api/item/{item_id}/content", get(item::handle_get_item_content));
|
||||
|
||||
#[cfg(feature = "mcp")]
|
||||
{
|
||||
router = router.route("/mcp/sse", get(mcp::handle_mcp_sse));
|
||||
}
|
||||
|
||||
router
|
||||
}
|
||||
|
||||
pub fn add_docs_routes(router: Router<AppState>) -> Router<AppState> {
|
||||
|
||||
Reference in New Issue
Block a user