Skip to main content

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 asyncapi::AsyncApiConfig;
pub use asyncapi::ParseResult;
pub use asyncapi::ParsedChannel;
pub use asyncapi::ParsedMessage;
pub use asyncapi::ParsedOperation;
pub use asyncapi::ValidateRequest;
pub use asyncapi::ValidationResponse;
pub use asyncapi::parse_asyncapi_value;
pub use asyncapi::validate_message;
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::BackgroundTaskConfig;
pub use grpc::GrpcConfig;
pub use handler_response::HandlerResponse;
pub use handler_trait::Handler;
pub use handler_trait::HandlerResult;
pub use handler_trait::RequestData;
pub use handler_trait::StaticResponse;
pub use handler_trait::StaticResponseHandler;
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§

asyncapi
AsyncAPI v3 HTTP endpoints and spec parsing
auth
Authentication middleware for JWT and API keys.
background
bindings
cors
CORS (Cross-Origin Resource Sharing) handling
grpc
gRPC runtime support for Spikard
handler_response
handler_trait
Handler trait for language-agnostic request handling
jsonrpc
JSON-RPC protocol support for Spikard HTTP
lifecycle
openapi
OpenAPI 3.1.0 specification generation
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

Structs§

ApiKeyConfig
API Key authentication configuration
CompressionConfig
Compression configuration shared across runtimes
CorsConfig
CORS configuration for a route
JsonRpcMethodInfo
JSON-RPC method metadata for routes that support JSON-RPC
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
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
StructuredError
Canonical error payload: { error, code, details }.
ValidationError
Validation error containing one or more validation failures
ValidationErrorDetail
Individual validation error detail (FastAPI-compatible format)

Enums§

HookResult
Result of a lifecycle hook execution
Method
HTTP method
ParameterSource
Parameter source - where the parameter comes from

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).

Functions§

build_server_runtime
Build a Tokio runtime for serving HTTP requests with the configured worker count.