[−][src]Crate exonum_api
High-level wrapper around a web server used by the Exonum framework.
The core APIs of this crate are designed to be reasonably independent from the web server
implementation. actix
is currently used as the server backend.
The wrapper is used in Rust services and in plugins
for the Exonum node. The Rust runtime provides its own abstractions based on the wrapper;
consult its docs for details. Node plugins use ApiBuilder
directly.
Examples
Providing HTTP API for a plugin:
use exonum_api::{ApiBuilder}; #[derive(Serialize, Deserialize)] pub struct SomeQuery { pub first: u64, pub second: u64, } fn create_api() -> ApiBuilder { let mut builder = ApiBuilder::new(); builder .public_scope() .endpoint("some", |query: SomeQuery| async move { Ok(query.first + query.second) }); builder } let builder = create_api(); // `builder` can now be passed to the node via plugin interface // or via node channel.
Modules
backends | API backends. |
Structs
ApiAggregator | Aggregator of |
ApiBuilder | Exonum API builder, which is used to add endpoints to the node API. |
ApiManager | Component responsible for API management. The |
ApiManagerConfig | Configuration parameters for |
ApiScope | Exonum API builder for the concrete API scope or, in other words, API access level (public or private). |
Deprecated | Wrapper over an endpoint handler, which marks it as deprecated. |
Error | API HTTP error struct. |
ErrorBody | Body of an |
HttpStatusCode | An HTTP status code ( |
MovedPermanentlyError | A helper structure allowing to build |
NamedWith | API Endpoint extractor that also contains the endpoint name and its kind. |
UpdateEndpoints | Updates variable endpoints of the service, restarting all HTTP servers managed by the addressed
|
WebServerConfig | Configuration parameters for a single web server. |
With | API endpoint handler extractor which can extract a handler from various entities. |
Enums
Actuality | Endpoint actuality. |
AllowOrigin | CORS header specification. |
ApiAccess | Exonum API access level, either private or public. |
EndpointMutability | Mutability of the endpoint. Used for auto-generated endpoints, e.g.
in |
Traits
ApiBackend | This trait is used to implement an API backend for Exonum. |
ExtendApiBackend | API backend extender. |
Type Definitions
Result | Type alias for the usual synchronous result. |