This superfood api performs CRUD (Create, Read, Update and Delete) operations. A superfood is a healthy food source that provides health benefits. This api can be used to discover interesting facts about super food products.
The following instructions will get the project up and running on your local machine for development and testing purposes.
You must have Node.js and MongoDB installed on your machine. You can click the below links, if you don’t have them already installed.
This app runs off of a MongoDB Database. Whether you have Mongo running locally or in production.
First run the install command to fetch all the dependency packages listed in the project's package.json file.
-
npm install
-
Then run the application
-
npm run start
Please make sure you have MongoDB server running either locally or in production.
To add superfood data to the running mongoDB database run the following command:
npm run populate
After you have run the above command you will see the superfood data displayed in your terminal/console window.
Once data has been added to the MongoDB database run following command:
npm run start
to re-run the server.
You can make the following requests:
(GET) /superfoods
(GET) /superfoods/:id
Postman API tutorial for beginners
In postman you can create and test the following routes:
(POST) /superfoods/create
(DELETE) /superfoods/:id
(PATCH) /superfoods/:id
To run tests run following command:
npm run tests
All documentation for methods and functions can be found in:
docs
Please note: open the docs .html files in browser