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
62
63
64
65
66
67
68
69
70
71
//! # StateSet HTTP
//!
//! HTTP service layer (REST + SSE) for the StateSet embedded commerce engine.
//!
//! Turns [`stateset_embedded::Commerce`] into a real HTTP API powered by
//! [`axum`], complete with JSON endpoints, pagination, Server-Sent Events,
//! CORS, request-ID tracing, and structured error responses.
//!
//! ## Quick Start
//!
//! ```rust,ignore
//! use stateset_embedded::Commerce;
//! use stateset_http::ServerBuilder;
//! use std::net::SocketAddr;
//!
//! let commerce = Commerce::new(":memory:")?;
//! let addr: SocketAddr = "0.0.0.0:3000".parse()?;
//!
//! ServerBuilder::new_from_env(commerce)?
//! .bind(addr)
//! .with_cors()
//! .with_request_id()
//! .with_bearer_auth("replace-me-with-a-secret")
//! .serve()
//! .await?;
//! ```
//!
//! ## Architecture
//!
//! ```text
//! ┌────────────────────────────────────────────────┐
//! │ HTTP Client │
//! │ ┌──────────────────────────────────────────┐ │
//! │ │ axum Router (this crate) │ │
//! │ │ ┌────────────────────────────────────┐ │ │
//! │ │ │ stateset-embedded (Commerce) │ │ │
//! │ │ │ ┌──────────────────────────────┐ │ │ │
//! │ │ │ │ SQLite / PostgreSQL │ │ │ │
//! │ │ │ └──────────────────────────────┘ │ │ │
//! │ │ └────────────────────────────────────┘ │ │
//! │ └──────────────────────────────────────────┘ │
//! └────────────────────────────────────────────────┘
//! ```
pub use *;
pub use HttpError;
pub use ServerBuilder;
pub use ;
// Re-export the router assembly function for users who want to embed the
// routes in a larger application.
pub use api_router;
use http as _;