- Hexagonal Architecture (a.k.a Ports and Adapters)
- clone this repository
git clone git@github.com:vindecodex/togo.git-
npm install -
copy env variables
cp .env-sample .envNote: (FOR NONE DOCKER ONLY) Please create 'togo' database before running the program
- npm run dev
NOTE: Also close other running mysql server from your computer it will conflict with the mysql docker image
docker-compose up --buildnpm run test or npm t
curl http://localhost:3000Should output Welcome Togo
You cannot create a task If you don't have an account.
curl -d 'username=test&password=test' http://localhost:3000/userShould output {"id":1,"username":"test","type":"BASIC"}
Get a token to allow creating task
curl -d 'username=test&password=test' http://localhost:3000/authenticateShould output
{
"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJ0ZXN0IiwidHlwZSI6IkJBU0lDIiwiaWF0IjoxNjU4MzkyOTk1fQ.6LOrSehIyFGhYRULxOYvm2o1jLVFFzv3gkHSaZqYfBM"
}Copy Token value to be used for posting task
NOTE: Newly created user has only BASIC account which means you can only post 5 task per day, you can subscribe to PREMIUM to have 10 task per day.
curl -d 'task=YOUR_TASK' -H "Authorization: Bearer TOKEN_HERE" http://localhost:3000/todoShould say true if added successfully
NOTE: You need to re-authenticate after upgrading.
curl -H "Authorization: Bearer TOKEN_HERE" http://localhost:3000/upgradeShould say true if upgrade success.
curl http://localhost:3000/todocurl http://localhost:3000/todo/user/{userId}