Example-webserver-rs
Project aims for setting up basic webserver functionality written in Rust and providing a few ready-to-use endpoints. It serves for learning purposes and figuring out Rust libraries ecosystem. Implemented with Axum framework.
Implemented
- Routing
- GET/POST requests
- parsing JSON request/response contents
- FromRequest/IntoResponse traits
- shared state with Clone trait or Atomic Reference Counting
Examples
- GET /
curl -X GET 127.0.0.1:3000
- GET /json
curl -X GET 127.0.0.1:3000/json
- GET /json-counter
curl -X GET 127.0.0.1:3000/json-counter
- POST /append
curl \
-X POST 127.0.0.1:3000/append \
-H "Content-Type: application/json" \
-d '{"data": "hello"}'
- GET /rnd
curl -X GET 127.0.0.1:3000/rnd