1
0
mirror of https://github.com/actix/examples synced 2025-06-27 01:27:43 +02:00

Restructure folders (#411)

This commit is contained in:
Daniel T. Rodrigues
2021-02-25 21:57:58 -03:00
committed by GitHub
parent 9db98162b2
commit c3407627d0
334 changed files with 127 additions and 120 deletions

34
json/jsonrpc/README.md Normal file
View File

@ -0,0 +1,34 @@
A simple demo for building a `JSONRPC over HTTP` server in [actix-web](https://github.com/actix/actix-web).
# Server
```sh
$ cargo run
# Starting server on 127.0.0.1:8080
```
# Client
**curl**
```sh
$ 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**
```sh
$ python tests\test_client.py
# {'jsonrpc': '2.0', 'result': 'pong', 'error': None, 'id': 1}
```
# Methods
- `ping`: Pong immeditely
- `wait`: Wait `n` seconds, and then pong
- `get`: Get global count
- `inc`: Increment global count
See `tests\test_client.py` to get more information.