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