API REST instructions.
You can import the JSON collection from postman that is included in the main directory.
You can also see the REST API collection here:
https://documenter.getpostman.com/view/13518759/2s8479ybUD
Note: CD/CI applied. Github linked to heroku for continuous and automated deployment.
These are the endpoints with which to obtain information:
Remember that 'auth-token' header must be sent in order to obtain information from the /api endpoints.
METHOD | DATA | ENDPOINT |
---|---|---|
GET | Get all phones | https://onebeyond-hector.herokuapp.com/api/getAll |
GET | Get one phone by ID | https://onebeyond-hector.herokuapp.com/api/getOne/6347f636ab3b54a6466ea607 |
POST | Register new user | https://onebeyond-hector.herokuapp.com/auth/register |
POST | Login with an existin account. This response throw a JWT that will be necesary on /api routes | https://onebeyond-hector.herokuapp.com/auth/login |
POST | Save new phone data | https://onebeyond-hector.herokuapp.com/api/createOne |
PATCH | Update phone data | https://onebeyondhector.herokuapp.com/api/update/6347f636ab3b54a6466ea607 |
DELETE | Remove a phone. IMPORTANT: The DELETE method has been added to complete the CRUD requested in the Code Challenge. The phone object, has in its interior an ACTIVE property (true or false), that in a real use, would be the property that would be deactivated in case of deleting, in order not to lose the consistency of data in the DDBB. | https://onebeyond-hector.herokuapp.com/api/delete/63480560ab3b54a6466ea66a |
IMPORTANT: Remember that requests /api needs 'auth-token' header. This JWT is generated on login inside app or if you are using Postman, inside Login request -> Test tab
The MongoDB database has been used for data persistence.