This is the backend API for the NutriHelp project. It is a RESTful API that provides the necessary endpoints for the frontend to interact with the database.
- Open a terminal and navigate to the directory where you want to clone the repository.
- Run the following command to clone the repository:
git clone https://github.com/Gopher-Industries/Nutrihelp-api- Navigate to the project directory:
cd Nutrihelp-api- Install the required dependencies (including python dependencies):
npm install
pip install -r requirements.txt
npm install node-fetch
npm install --save-dev jest supertest- Contact a project maintainer to get the
.envfile that contains the necessary environment variables and place it in the root of the project directory. - Start the server:
npm startA message should appear in the terminal saying Server running on port 80.
You can now access the API at http://localhost:80.
The API is documented using OpenAPI 3.0, located in index.yaml.
You can view the documentation by navigating to http://localhost:80/api-docs in your browser.
- In order to run the jest test cases, make sure your package.json file has the following test script added:
"scripts": {
"test": "jest"
}Also, have the followiing dependency added below scripts:
"jest": {
"testMatch": [
"**/test/**/*.js"
]
},- Make sure to run the server before running the test cases.
- Run the test cases using jest and supertest:
npx jest .\test\<TEST_SUITE_FILE_NAME>For example:
npx jest .\test\healthNews.test.js/\ Please refer to the "PatchNotes_VersionControl" file for /
/\ recent updates and changes made through each version. /\