https://github.com/gothinkster/realworld/tree/master/api#authentication
Login
POST /api/users/login
Register
POST /api/users
Get current user (requires login token)
GET /api/user
Update user (requires login token)
PUT /api/user
Since our sql statements are being verified at compile time, the database must be running before we compile the project.
docker-compose up -d
With the database up:
cargo run --release
Endpoint is served at localhost:8080
curl --header "Content-Type: application/json" \
--request POST \
--data '{"user":{"username":"hello","email":"hello@example.com","password":"password"}}' \
http://localhost:8080/api/users
The previous register response should contain a token field, replace $token with it:
curl --header "Content-Type: application/json" \
--header "Authorization: Token $token" \
--request GET \
http://localhost:8080/api/user
curl --header "Content-Type: application/json" \
--request POST \
--data '{"user":{"email":"hello@example.com","password":"password"}}' \
http://localhost:8080/api/users/login
To stop and delete the db container and volume:
docker-compose down