Skip to main content

reifydb_sub_server_http/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2025 ReifyDB
3
4#![cfg_attr(not(debug_assertions), deny(warnings))]
5
6//! HTTP server subsystem for ReifyDB.
7//!
8//! This crate provides an Axum-based HTTP server for handling query and command
9//! requests. It integrates with the shared tokio runtime and implements the
10//! transaction ReifyDB `Subsystem` trait for lifecycle management.
11//!
12//! # Features
13//!
14//! - REST API for query and command execution
15//! - Bearer token and auth token authentication
16//! - Request timeouts and connection limits
17//! - Graceful shutdown support
18//! - Health check endpoint
19//!
20//! # Endpoints
21//!
22//! - `GET /health` - Health check (no authentication required)
23//! - `POST /v1/query` - Execute read-only queries
24//! - `POST /v1/command` - Execute write commands
25//!
26//! # Example
27//!
28//! ```ignore
29//! use reifydb_core::SharedRuntime;
30//! use reifydb_sub_server::{AppState, QueryConfig};
31//! use reifydb_sub_server_http::HttpSubsystem;
32//!
33//! // Create shared runtime
34//! let runtime = SharedRuntime::new(4);
35//!
36//! // Create application state
37//! let state = AppState::new(pool, engine, QueryConfig::default(), RequestInterceptorChain::empty());
38//!
39//! // Create and start HTTP subsystem
40//! let mut http = HttpSubsystem::new(
41//!     "0.0.0.0:8090".to_string(),
42//!     state,
43//!     runtime.handle(),
44//! );
45//! http.start()?;
46//! ```
47
48#![cfg_attr(not(debug_assertions), deny(warnings))]
49
50pub mod error;
51pub mod factory;
52pub mod handlers;
53pub mod routes;
54pub mod subsystem;