8 releases
0.2.1 | Oct 4, 2024 |
---|---|
0.2.0 | Sep 7, 2024 |
0.1.5 | Aug 28, 2024 |
0.1.0 | Jun 24, 2024 |
#25 in #json-rpc-server
148 downloads per month
Used in prople-vesseld
51KB
788 lines
prople/jsonrpc/axum
An implementation of JSON-RPC
server using Tokio Axum
.
WARNING!
There is a breaking changes from
0.1.x
to latest version:0.2.0
Please always use the latest version which provides more nicer API
Usages
use rst_common::with_tokio::tokio;
use prople_jsonrpc_axum::rpc::{RpcConfig, RpcError, Rpc};
#[tokio::main]
async fn main() -> Result<(), RpcError> {
// you need to configure your `RpcProcessor`
// assumed you have already set the object
let state = RpcState::new(processor);
let config = RpcConfig::new(String::from("host"), String::from("port"));
// assumed you've already set your Axum's endpoint Router
// the `app` variable defined here should be an instance of axum::Router
let rpc = Rpc::new(config, state, app);
let _ = rpc.serve()?;
}
Installation
[dependencies]
prople-jsonrpc-axum = {version = "0.2.0"}
Dependencies
~16–29MB
~422K SLoC