feat: integrate CoreDoc documentation routes into web server
- Add 'fs' feature to tower-http for ServeDir support - Integrate docs_routes() into main router - Support three documentation endpoints: * /docs/legacy - Legacy WASM documentation system * /docs/api - API documentation * /docs/cli - CLI documentation - Add generic type parameter to docs_routes for AppState compatibility - Add INSTALLATION.md with auto-installation instructions Tested successfully: - Service running on port 11438 - All documentation endpoints accessible - API health check passing
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
use axum::Router;
|
||||
use tower_http::services::ServeDir;
|
||||
|
||||
pub fn docs_routes() -> Router {
|
||||
pub fn docs_routes<S>() -> Router<S>
|
||||
where
|
||||
S: Clone + Send + Sync + 'static,
|
||||
{
|
||||
Router::new()
|
||||
// Legacy WASM documentation system
|
||||
.nest_service("/legacy", ServeDir::new("/Users/accusys/momentry_core/docs_v1.0/doc_wasm"))
|
||||
.nest_service("/docs/legacy", ServeDir::new("/Users/accusys/momentry_core/docs_v1.0/doc_wasm"))
|
||||
|
||||
// New API documentation
|
||||
.nest_service("/api", ServeDir::new("/Users/accusys/momentry_core/docs_v1.0/API_WORKSPACE"))
|
||||
.nest_service("/docs/api", ServeDir::new("/Users/accusys/momentry_core/docs_v1.0/API_WORKSPACE"))
|
||||
|
||||
// New CLI documentation
|
||||
.nest_service("/cli", ServeDir::new("/Users/accusys/momentry_core/docs_v1.0/CLI_WORKSPACE"))
|
||||
.nest_service("/docs/cli", ServeDir::new("/Users/accusys/momentry_core/docs_v1.0/CLI_WORKSPACE"))
|
||||
}
|
||||
@@ -26,6 +26,7 @@ use crate::audio;
|
||||
use crate::auth::{AuthState, LoginRequest};
|
||||
use crate::provider::sqlite::SqliteProvider;
|
||||
use crate::render;
|
||||
use crate::api::docs::docs_routes;
|
||||
use filetree::{self, FileTree};
|
||||
use tower_http::cors::CorsLayer;
|
||||
|
||||
@@ -279,6 +280,8 @@ pub async fn run(port: u16, file: Option<String>, home: PathBuf) -> anyhow::Resu
|
||||
.route("/body", get(body_handler))
|
||||
.route("/status", get(status_handler))
|
||||
.route("/labels", get(get_labels).post(post_labels))
|
||||
// CoreDoc documentation system
|
||||
.merge(docs_routes())
|
||||
// Auth endpoints (public)
|
||||
.route("/api/v2/auth/login", post(login_handler))
|
||||
.route("/api/v2/auth/logout", post(logout_handler))
|
||||
|
||||
Reference in New Issue
Block a user