Module api_server

Module api_server 

Source
Expand description

REST API server for pipeline management (T30) + web dashboard (T31) REST API server for pipeline management (T30)

Provides an HTTP API for submitting, monitoring, and managing scraping pipelines. Includes a built-in web dashboard served at / (T31).

§Endpoints

MethodPathDescription
GET/healthLiveness probe
GET/metricsPrometheus metrics
GET/Web dashboard (HTML)
POST/pipelinesSubmit a new pipeline
GET/pipelinesList all pipelines
GET/pipelines/:idGet pipeline status
GET/pipelines/:id/resultsGet pipeline results
DELETE/pipelines/:idCancel / delete a pipeline

§Authentication

All /pipelines routes require an X-Api-Key header. Set the API key via the STYGIAN_API_KEY environment variable (defaults to "dev-key" when the variable is not set).

§Example

use stygian_graph::application::api_server::ApiServer;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let server = ApiServer::from_env();
    server.run("0.0.0.0:8080").await
}

Structs§

ApiServer
High-level API server wrapper.
AppState
Shared state injected into every route handler.
PipelineRun
A pipeline run record stored in the in-memory registry.
PipelineStatus
Slim status summary returned by GET /pipelines and GET /pipelines/:id
SubmitPipelineRequest
Request body for POST /pipelines
SubmitPipelineResponse
Response from POST /pipelines

Enums§

PipelineState
Current execution state of a submitted pipeline.

Functions§

build_router
Build the axum [Router] with all routes and middleware attached.