jsonrpc-http-server
Rust http server using JSON-RPC 2.0.
Example
Cargo.toml
[dependencies]
jsonrpc-http-server = "3.0"
main.rs
extern crate jsonrpc_core;
extern crate jsonrpc_http_server;
use *;
use *;
;
Rust http server using JSON-RPC 2.0.
Cargo.toml
[dependencies]
jsonrpc-http-server = "3.0"
main.rs
extern crate jsonrpc_core;
extern crate jsonrpc_http_server;
use jsonrpc_core::*;
use jsonrpc_http_server::*;
struct SayHello;
impl MethodCommand for SayHello {
fn execute(&self, _params: Option<Params>) -> Result<Value, Error> {
Ok(Value::String("hello".to_string()))
}
}
fn main() {
let io = IoHandler::new();
io.add_method("say_hello", SayHello);
let server = Server::new(Arc::new(io));
server.start("127.0.0.1:3030".to_string(), AccessControlAllowOrigin::Null, 1);
}