refactor: restructure API routes with /api prefix and update content endpoint paths
This commit is contained in:
committed by
Andrew Phillips (aider)
parent
68c5514a44
commit
25b70492bc
@@ -9,21 +9,19 @@ use crate::modes::server::api::{
|
||||
};
|
||||
use crate::modes::server::docs;
|
||||
|
||||
pub fn api_router() -> Router<AppState> {
|
||||
Router::new()
|
||||
pub fn add_routes(router: Router<AppState>) -> Router<AppState> {
|
||||
router
|
||||
// Status endpoints
|
||||
.route("/status", get(status::handle_status))
|
||||
.route("/api/status", get(status::handle_status))
|
||||
|
||||
// Item endpoints
|
||||
.route("/item/", get(item::handle_list_items).post(item::handle_post_item))
|
||||
.route("/item/latest", get(item::handle_get_item_latest))
|
||||
.route("/item/latest/meta", get(item::handle_get_item_latest_meta))
|
||||
.route("/content", get(item::handle_get_content_latest))
|
||||
.route("/content/:id", get(item::handle_get_content))
|
||||
.route("/content-raw", get(item::handle_get_content_latest_raw))
|
||||
.route("/content-raw/:id", get(item::handle_get_content_raw))
|
||||
.route("/item/:id", get(item::handle_get_item).delete(item::handle_delete_item))
|
||||
.route("/item/:id/meta", get(item::handle_get_item_meta))
|
||||
.route("/api/item/", get(item::handle_list_items).post(item::handle_post_item))
|
||||
.route("/api/item/latest", get(item::handle_get_item_latest))
|
||||
.route("/api/item/latest/meta", get(item::handle_get_item_latest_meta))
|
||||
.route("/api/item/latest/content", get(item::handle_get_content_latest))
|
||||
.route("/api/item/:id", get(item::handle_get_item).delete(item::handle_delete_item))
|
||||
.route("/api/item/:id/meta", get(item::handle_get_item_meta))
|
||||
.route("/api/item/:id/content", get(item::handle_get_content))
|
||||
|
||||
// Documentation endpoints
|
||||
.route("/openapi.json", get(docs::handle_openapi))
|
||||
|
||||
Reference in New Issue
Block a user