Tools needed:
- docker
- docker-compose
- make
- curl
make build
make create
make migrate
make destroy
To make requests authentications is needed. How to authenticate:
- First create a new user
curl --request 'POST' \
--header 'Content-Type: application/json' \
--data '{"username":"User Name","email":"email@email.com","password":"12345"}' \
'localhost/api/register'
- After creating an user you need to get a new valid token, it lasts for 12 hours.
curl --request 'POST' \
--header 'Content-Type: application/json' \
--data '{"email":"email@email.com","password":"12345"}' \
'localhost/auth/login'
- After getting a new token change Makefile variable
VALID_TOKEN
on the top of the file to make your life easier when creating some new data.
curl --request 'POST' --header "Authorization: Bearer ${VALID_TOKEN}" \
--header 'Content-Type: application/json' \
--data '{"author":"User Name","content":"I love programming."}' \
'localhost/api/quotes'
- Get all posts from a single author:
curl 'localhost/api/authors/1'
- Get all posts:
curl 'localhost/api/quotes'
- GET endpoints
/api/authors/<id>
(needs authentication)/api/quotes/<id>
(needs authentication)/api/quotes
(needs authentication)/api/healthcheck
/auth/healthcheck
- POST endpoits
/api/quotes
(needs authentication)/api/register
/auth/login
./authors/run_tests.sh
- Add queue on
/api/register
and/api/quotes
. - Add services more tests.