1pub mod api;
4pub mod dashboard;
5pub mod openai;
6pub mod streaming;
7
8use axum::{routing::get, Json, Router};
9use cortiq_engine::{CortiqRuntime, Pipeline};
10use std::sync::Arc;
11use tokio::sync::Mutex;
12use tower_http::cors::CorsLayer;
13
14pub struct AppState {
17 pub runtime: CortiqRuntime,
18 pub pipeline: Mutex<Pipeline>,
19}
20
21async fn healthz() -> Json<serde_json::Value> {
25 Json(serde_json::json!({ "status": "ok" }))
26}
27
28pub fn build_router(state: Arc<AppState>) -> Router {
30 Router::new()
31 .route("/healthz", get(healthz))
32 .merge(openai::routes())
33 .merge(api::routes())
34 .merge(dashboard::routes())
35 .layer(CorsLayer::permissive())
36 .with_state(state)
37}