1
0
mirror of https://github.com/actix/examples synced 2024-11-27 16:02:57 +01:00
examples/async_ex1/README.md

21 lines
798 B
Markdown
Raw Normal View History

2018-04-27 21:30:29 +02:00
This is a contrived example intended to illustrate a few important actix-web features.
2018-04-27 21:31:34 +02:00
2018-04-27 21:30:29 +02:00
*Imagine* that you have a process that involves 3 steps. The steps here
are dumb in that they do nothing other than call an
httpbin endpoint that returns the json that was posted to it. The intent here
is to illustrate how to chain these steps together as futures and return
a final result in a response.
Actix-web features illustrated here include:
2018-04-27 21:31:34 +02:00
2018-04-27 21:30:29 +02:00
1. handling json input param
2. validating user-submitted parameters using the 'validator' crate
2. actix-web client features:
- POSTing json body
3. chaining futures into a single response used by an asynch endpoint
Example query from the command line using httpie:
```http post 127.0.0.1:8088/something id=1 name=JohnDoe```