rs-jsonrpc-http-server

Rust http server using JSON-RPC 2.0.

Documentation

Example

Cargo.toml

[dependencies] rs-jsonrpc-core = { git = "https://github.com/susytech/s-jsonrpc" } rs-jsonrpc-http-server = { git = "https://github.com/susytech/s-jsonrpc" }

main.rs

```rust extern crate rsjsonrpccore; extern crate rsjsonrpchttp_server;

use rsjsonrpccore::; use rs_jsonrpc_http_server::;

fn main() { let mut io = IoHandler::default(); io.addmethod("sayhello", |_| { Ok(Value::String("hello".into())) });

let server = ServerBuilder::new(io)
        .cors(DomainsValidation::AllowOnly(vec![AccessControlAllowOrigin::Null]))
        .start_http(&"127.0.0.1:3030".parse().unwrap())
        .expect("Unable to start RPC server");

server.wait().unwrap();

} ```