A project created for the end of module 4 of Resília Educação, it was made to simulate a system of stores in a dental companies, the stores are composed by ID, CNPJ, ADDRESS, STORE EMAIL, STORE PHONE and the number of employees (HEADCOUNT).
To have a better view of how the api works, click on the link: https://still-atoll-05418.herokuapp.com/store
NOTE: put in the parameter at the end of the link /store
First at the terminal type the command to download the dependencies of this project.
npm install
After downloading, use the npm start command to start.
npm start
The project was built following the rest pattern with the 4 necessary HTTP verbs: Get,Post,Put and Delete, with that the CRUD system was applied, to read, create, update and delete.
- To query all system stores, with a request tester in the get method use the route :
http://localhost:3000/store
.
- If the request is all right, it will receive this as an response, if it gives an error, it will be the answer containing the error.
- To find a specific store in the system, use the route with the same method in the program :
http://localhost:3000/store/:id
,replace:id
with the cnpj of the store you want to find.
- If the request is all right, it will receive this as an response, if it gives an error, it will be the answer containing the error.
- To insert a new store, now using the POST method in the program, use the route :
localhost:3000/store
route with the following data as in the example below.
- If the request is all right, it will receive this as an response, if it gives an error, it will be the answer containing the error.
- To update data from a store, now with the PUT method use the route
localhost:3000/:id
replace:id
with the cnpj of the store and with the fields you want to update.
- If the request is all right, it will receive this as an response, if it gives an error, it will be the answer containing the error.
- Finally, to delete a store from the system, use the route
localhost:3000/:id
,replace the:id
with the cnpj of the store you want to delete
- If the request is all right, it will receive this as an response, if it gives an error, it will be the answer containing the error.
-
to test the model or the routes, type in the terminal:
npm test
-
NodeJs
-
Express
-
Sequelize
-
Mocha.js and Chai.js