In this ticket, we worked on creating the GET, POST, PUT, and DELETE requests for the Hexagon, Province, and County objects.
Testing
We utilized postman to test these endpoints. First, ensure that you are in the backend folder. Then, run npm start in the terminal so connect to the database server. Follow the following steps to test that the endpoints work:
POST:
In the body tab in Postman, add the attributes of the object (ie. specify what all of the fields for the hexagon, province or county object should be so that you can create a new object).
Add the url of the request and make sure that POST is selected
Send the request. This should have created a new object and added it to the database.
GET:
Check that the url of the request is correct and make sure that GET is selected
Send the request. If an object of the type being tested has been created, it should be listed as one in the database.
UPDATE:
Choose an object to update. Then, copy its id for future use.
Choose an attribute of the object to update, and in the body, specify what the attribute should be updated to.
Add the id to the end of the url (like this: /[_id]) and make sure that PUT is selected.
Send the request. If you run GET again, you should see that this object has been updated with the specified attribute.
DELETE:
Choose an object to delete. Then, copy its id for future use.
Add the id to the end of the url (just like in update) and make sure that DELETE is selected.
Send the request. If you run GET again, you should see that this object has been deleted.
Impact
This PR will help with creating and editing objects in the database.
Notes
Very small thing for counties - when creating the requests for counties, county was used instead of soum so that it is consistent with the attributes in the schema. However, changing it to soum is an easy fix, so feel free to let us know if this change should be made!
Overview
In this ticket, we worked on creating the GET, POST, PUT, and DELETE requests for the Hexagon, Province, and County objects.
Testing
We utilized postman to test these endpoints. First, ensure that you are in the backend folder. Then, run
npm start
in the terminal so connect to the database server. Follow the following steps to test that the endpoints work:POST:
GET:
UPDATE:
/[_id]
) and make sure that PUT is selected.DELETE:
Impact
This PR will help with creating and editing objects in the database.
Notes
Very small thing for counties - when creating the requests for counties,
county
was used instead ofsoum
so that it is consistent with the attributes in the schema. However, changing it tosoum
is an easy fix, so feel free to let us know if this change should be made!