Refactoring the structure a bit

This commit is contained in:
Dave
2026-02-16 16:24:21 +00:00
parent a2188e2c7f
commit 5923165fcf
21 changed files with 522 additions and 372 deletions

34
server/src/http/mod.rs Normal file
View File

@@ -0,0 +1,34 @@
pub mod anthropic;
pub mod assets;
pub mod chat;
pub mod context;
pub mod fs;
pub mod health;
pub mod model;
pub mod payloads;
pub mod project;
pub mod rest;
pub mod search;
pub mod shell;
pub mod ws;
use crate::http::context::AppContext;
use crate::http::rest::build_openapi_service;
use poem::EndpointExt;
use poem::{Route, get};
pub fn build_routes(ctx: AppContext) -> impl poem::Endpoint {
let ctx_arc = std::sync::Arc::new(ctx);
let (api_service, docs_service) = build_openapi_service(ctx_arc.clone());
Route::new()
.nest("/api", api_service)
.nest("/docs", docs_service.swagger_ui())
.at("/ws", get(ws::ws_handler))
.at("/health", get(health::health))
.at("/assets/*path", get(assets::embedded_asset))
.at("/", get(assets::embedded_index))
.at("/*path", get(assets::embedded_file))
.data(ctx_arc)
}