1
0
mirror of https://github.com/actix/examples synced 2025-03-10 15:32:38 +01:00
examples/json/json/README.md

49 lines
1.1 KiB
Markdown
Raw Normal View History

# json
2022-02-06 08:25:38 +00:00
Json's `Getting Started` guide using json (serde-json or json-rust) for Actix Web
## Usage
### server
2022-02-18 03:36:04 +00:00
```sh
cd json/json
cargo run
# Started http server: 127.0.0.1:8080
```
### web client
With [Postman](https://www.getpostman.com/) or [Rested](moz-extension://60daeb1c-5b1b-4afd-9842-0579ed34dfcb/dist/index.html)
- POST / (embed serde-json):
2022-03-06 00:43:10 +00:00
- method : `POST`
- url : `http://127.0.0.1:8080/`
- header : `Content-Type` = `application/json`
- body (raw) : `{"name": "Test user", "number": 100}`
- POST /manual (manual serde-json):
2022-03-06 00:43:10 +00:00
- method : `POST`
- url : `http://127.0.0.1:8080/manual`
- header : `Content-Type` = `application/json`
- body (raw) : `{"name": "Test user", "number": 100}`
- POST /mjsonrust (manual json-rust):
2022-03-06 00:43:10 +00:00
- method : `POST`
- url : `http://127.0.0.1:8080/mjsonrust`
- header : `Content-Type` = `application/json`
- body (raw) : `{"name": "Test user", "number": 100}` (you can also test `{notjson}`)
### python client
2022-03-06 00:43:10 +00:00
- `pip install aiohttp`
- `python client.py`
if ubuntu :
2022-03-06 00:43:10 +00:00
- `pip3 install aiohttp`
- `python3 client.py`