| Crates.io | exonum-api |
| lib.rs | exonum-api |
| version | 1.0.0 |
| created_at | 2020-02-07 15:01:35.150548+00 |
| updated_at | 2020-03-31 15:39:19.172975+00 |
| description | HTTP API engine of the Exonum framework |
| homepage | https://exonum.com/ |
| repository | https://github.com/exonum/exonum |
| max_upload_size | |
| id | 205817 |
| size | 68,089 |
exonum-api crate provides an extensible interface for building backend-agnostic
HTTP APIs.
Within Exonum, this crate is used by Rust services and in
plugins for the Exonum node.
Under the hood exonum-api uses actix.
Consult the crate docs for more details.
Providing HTTP API for a plugin:
use exonum_api::{ApiBuilder};
use serde_derive::{Deserialize, Serialize};
#[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| {
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.
Include exonum-api as a dependency in your Cargo.toml:
[dependencies]
exonum-api = "1.0.0"
Note that the crate rarely needs to be imported directly; it is re-exported
by the exonum crate.
exonum-api is licensed under the Apache License (Version 2.0).
See LICENSE for details.