mirror of
https://github.com/actix/examples
synced 2024-11-24 06:43:00 +01:00
0c4ab86a9a
inspired by #406 |
||
---|---|---|
.. | ||
src | ||
tests | ||
Cargo.toml | ||
README.md |
A simple demo for building a JSONRPC over HTTP
server in actix-web.
Server
cd json/jsonrpc
cargo run
# Starting server on 127.0.0.1:8080
Client
curl
$ curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "method": "ping", "params": [], "id": 1}' http://127.0.0.1:8080
# {"jsonrpc":"2.0","result":"pong","error":null,"id":1}
python
$ python tests\test_client.py
# {'jsonrpc': '2.0', 'result': 'pong', 'error': None, 'id': 1}
Methods
ping
: Pong immeditelywait
: Waitn
seconds, and then pongget
: Get global countinc
: Increment global count
See tests\test_client.py
to get more information.