greentic-flow-builder 0.1.0

AI-powered Adaptive Card flow builder with visual graph editor and demo runner
Documentation
//! HTTP routes for the Flow Builder web UI.
//!
//! Each submodule owns a single logical endpoint. `build()` assembles them
//! into a single Axum `Router` that `ui::launch()` serves.

pub mod assets;
pub mod chat;
pub mod discovery;
pub mod primitives;
pub mod render;
pub mod render_flow;
pub mod templates;
pub mod themes;

use super::state::AppState;
use axum::Router;
use axum::extract::DefaultBodyLimit;
use axum::routing::{get, post};
use std::sync::Arc;

/// Build the Axum router with all API routes and static assets wired up.
pub fn build(state: Arc<AppState>) -> Router {
    Router::new()
        .route("/", get(assets::serve_index))
        .route("/app.js", get(assets::serve_js))
        .route("/style.css", get(assets::serve_css))
        .route("/api/templates", get(templates::list_templates))
        .route("/api/templates/{name}", get(templates::get_template))
        .route("/api/primitives", get(primitives::list_primitives))
        .route("/api/themes", get(themes::list_themes))
        .route("/api/themes/{name}", get(themes::get_theme))
        .route("/api/render", post(render::post_render))
        .route("/api/render-flow", post(render_flow::post_render_flow))
        .route("/api/discovery/search", get(discovery::search))
        .route("/api/chat", post(chat::post_chat))
        .layer(DefaultBodyLimit::max(16 * 1024 * 1024))
        .with_state(state)
}