Prerequisites
Ensure you have Node.js and npm installed. On Ubuntu/Debian:Verify your installations:
1. Clone the Repository
Fetch the source code from GitLab and navigate into the project folder:2. Install Dependencies
Install all production and development packages defined inpackage.json:
3. Review package.json
Open package.json to understand scripts, coverage settings, and dependencies.
Scripts Overview
NYC Coverage Configuration
Dependencies
Dev Dependencies
4. Application Entry Point (app.js)
This file initializes Express, connects to MongoDB via Mongoose, and defines your REST API endpoints.
Never commit real credentials. Use environment variables or a secrets manager.
5. Test Suite (app-test.js)
Uses Mocha, Chai, and Chai HTTP to validate your API endpoints.
6. Client Logic (client.js)
A simple front-end script that fetches all planets on page load:
7. Dockerfile
Containerize the application for consistent deployment:8. Kubernetes Service Manifest
Expose the application via a NodePort service:9. Running Tests Locally
9.1 Without Environment Variables
9.2 Temporary Hard-Coding (Demo Only)
Replace themongoose.connect call in app.js:
test_results.xml file will be created for CI consumption.
10. Generating Coverage Reports
coverage/, including:
- cobertura-coverage.xml
- coverage-summary.json
- lcov report
11. Start the Application
Run the server locally:http://localhost:3000 in your browser. Use the search bar to query planets by ID.


You’re now prepared to integrate this setup into your GitHub Actions workflow for CI/CD automation.