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 dependencies (runs automated bootstrap via npm postinstall):
npm installWhat happens automatically:
- Node dependencies installed
- Environment bootstrap runs (
scripts/bootstrap.js --mode=postinstall) - If no
.envexists a minimal placeholder is generated (internal team must replace with real values) - Vulnerability scanner virtual environment prepared if Python 3 is available
- Environment validation runs (warnings only in postinstall mode)
- 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. /\
This repository includes a manual GitHub Actions workflow that runs the Vulnerability Scanner (V2) and optional tests.
How to run
- Open the repository on GitHub and go to the Actions tab.
- Select the workflow named
Manual Vulnerability & Test Scan. - Click the
Run workflowbutton.
Inputs
run_tests(default:false) — set totrueto run unit tests (npm run test:unit). Tests may require a database or other services; use with caution.fail_on_critical(default:false) — set totrueto make the job fail when the scanner JSON report contains one or moreCRITICALfindings.
Artifacts
vulnerability-scan-reports(artifact bundle) — contains:vulnerability_report.json— machine-readable scan resultsvulnerability_report.html— human-friendly HTML report (if HTML rendering succeeds)vulnerability_tool_report.txt— legacy/auxiliary scanner output (if generated)npm_audit.json— result ofnpm audit --json
Notes and recommendations
- The scanner excludes internal tool directories and common noisy paths (for example
Vulnerability_Tool_V2, legacyVulnerability_Tool,node_modules, test caches). - If you enable
run_tests, ensure the required environment (DB, credentials) is available to avoid noisy failures. - Use
fail_on_critical=truefor gating releases or running stricter checks in CI; keep itfalsefor quick, informational scans.