Crate spikard_http

Crate spikard_http 

Source
Expand description

Spikard HTTP Server

Pure Rust HTTP server with language-agnostic handler trait. Language bindings (Python, Node, WASM) implement the Handler trait.

Re-exports§

pub use auth::Claims;
pub use auth::api_key_auth_middleware;
pub use auth::jwt_auth_middleware;
pub use background::BackgroundHandle;
pub use background::BackgroundJobError;
pub use background::BackgroundJobMetadata;
pub use background::BackgroundRuntime;
pub use background::BackgroundSpawnError;
pub use background::BackgroundTaskConfig;
pub use body_metadata::ResponseBodySize;
pub use handler_response::HandlerResponse;
pub use handler_trait::Handler;
pub use handler_trait::HandlerResult;
pub use handler_trait::RequestData;
pub use handler_trait::ValidatedParams;
pub use jsonrpc::JsonRpcConfig;
pub use lifecycle::LifecycleHooks;
pub use lifecycle::LifecycleHooksBuilder;
pub use lifecycle::request_hook;
pub use lifecycle::response_hook;
pub use openapi::ContactInfo;
pub use openapi::LicenseInfo;
pub use openapi::OpenApiConfig;
pub use openapi::SecuritySchemeInfo;
pub use openapi::ServerInfo;
pub use response::Response;
pub use server::Server;
pub use sse::SseEvent;
pub use sse::SseEventProducer;
pub use sse::SseState;
pub use sse::sse_handler;
pub use testing::ResponseSnapshot;
pub use testing::SnapshotError;
pub use testing::snapshot_response;
pub use websocket::WebSocketHandler;
pub use websocket::WebSocketState;
pub use websocket::websocket_handler;

Modules§

auth
Authentication middleware for JWT and API keys.
background
bindings
body_metadata
Shared metadata stored on http::Response extensions.
cors
CORS (Cross-Origin Resource Sharing) handling
debug
Debug logging utilities for spikard-http
handler_response
handler_trait
Handler trait for language-agnostic request handling
jsonrpc
JSON-RPC protocol support for Spikard HTTP
lifecycle
middleware
HTTP middleware for request validation
openapi
OpenAPI 3.1.0 specification generation
query_parser
Fast query string parser
response
HTTP Response types
server
HTTP server implementation using Tokio and Axum
sse
Server-Sent Events (SSE) support for Spikard
testing
websocket
WebSocket support for Spikard

Macros§

debug_log
Log a debug message if debugging is enabled
debug_log_module
Log a debug message with a specific module/component name
debug_log_value
Log a debug value with pretty-printing

Structs§

ApiKeyConfig
API Key authentication configuration
CompressionConfig
Compression configuration shared across runtimes
CorsConfig
CORS configuration for a route
JwtConfig
JWT authentication configuration
ParameterValidator
Parameter validator that uses JSON Schema
ProblemDetails
RFC 9457 Problem Details for HTTP APIs
RateLimitConfig
Rate limiting configuration shared across runtimes
Route
Route definition with compiled validators
RouteMetadata
Route metadata extracted from bindings
Router
Router that manages routes
SchemaRegistry
Global schema registry for compiled validators
SchemaValidator
Schema validator that compiles and validates JSON Schema
ServerConfig
Server configuration
ServerConfigBuilder
Builder for ServerConfig
StaticFilesConfig
Static file serving configuration

Enums§

HookResult
Result of a lifecycle hook execution
Method
HTTP method

Constants§

CONTENT_TYPE_PROBLEM_JSON
Reexport from spikard_core for convenience Content-Type for RFC 9457 Problem Details

Traits§

LifecycleHook
Trait for lifecycle hooks on native targets (Send + Sync, Send futures).

Type Aliases§

RouteHandler
Handler function type (placeholder - will be enhanced with Python callbacks)