giseleml / learn-todo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Learn Todo codecov

A RESTful API generated by generator-rest.

See the API's documentation.

Running the project

  • With docker-compose: sudo docker-compose up
  • Back-end runs on port 9000

First Steps

  1. Create an user

curl -X POST http://0.0.0.0:9000/users -i -d "role=admin&email=your-email&password=your-password&access_token=MASTER_KEY_HERE"

The MASTER_KEY can be found on the .env file and will also be required for the next step.

When the user is created the API will return your token which will be necessary to call any endpoint.

  1. Authenticate the user

curl -X POST http://0.0.0.0:9000/auth -i -u your-email:your-password -d "access_token=MASTER_KEY_HERE"

Methods

  • GET all to-dos

curl -X GET http://0.0.0.0:9000/todo -i -d "access_token=YOUR-TOKEN"

  • GET a single to-do

curl -X GET http://0.0.0.0:9000/todo/:id -i -d "access_token=YOUR-TOKEN"

  • POST a new to-do

curl -X POST -H "Content-Type: application/json" -d '{"content": "your-content", "access_token": "YOUR-TOKEN"}' http://0.0.0.0:9000/todo

  • UPDATE a to-do

curl -X PUT -H "Content-Type: application/json" -d '{"content": "New content", "access_token": "YOUR-TOKEN"}' http://0.0.0.0:9000/todo/:id

  • DELETE a to-do

curl -X DELETE -H "Content-Type: application/json" -d '{"access_token": "YOUR-TOKEN"}' http://0.0.0.0:9000/todo/:id

About


Languages

Language:JavaScript 99.7%Language:Dockerfile 0.2%Language:Shell 0.1%