emergentIOT / XERO_Api

Products API
0 stars 0 forks source link

Nodejs and MongoDB Api

API LINK: https://australia-api.herokuapp.com/api/v1/products/

TODO: Working on Integrating JWT AUTH, Hosting the api on Raspberry PI4 and running it with minikube.

Docker Setup: I have used two images, which i have build & uploaded on my Docker account and i have used docker-compose.yml(included in project) to run services all together.

I have used Postman to setup testing of endpoints.

Endpoints: All routes are defined in routes/product.route.js

  1. GET /products - gets all products.
  2. GET /products?name={name} - finds all products matching the specified name.
  3. GET /products/{productID} - gets the project that matches the specified ID - ID is a GUID.
  4. POST /products - creates a new product.
  5. PUT /products/{productID} - updates a product.
  6. DELETE /products/{productID} - deletes a product and its options.
  7. GET /products/{productID}/options - finds all options for a specified product.
  8. GET /products/{productID}/options/{optionId} - finds the specified product option for the specified product.
  9. POST /products/{productID}/options - adds a new product option to the specified product.
  10. PUT /products/{productID}/options/{optionId} - updates the specified product option.
  11. DELETE /products/{productID}/options/{optionId} - deletes the specified product option.

All models are specified in the /Models folder,

Help while running Docker Solution, (If docker file gives error while executing above commands. Follow below instructions)

Stop container on current dir 2. if there is a docker-compose.yml

  1. docker-compose down

Remove all containers

  1. docker rm -fv $(docker ps -aq)

List who's using the port

  1. sudo lsof -i -P -n | grep 27017
  2. then: - kill -9 (macOS) or - sudo kill (Linux).