A Node.js backend application running on port 8090, connected to MongoDB for data storage and Redis for caching. All configuration is loaded from environment variables.
node-devops-project/
├── app.js # Main application entry point
├── package.json # NPM dependencies & scripts
├── Dockerfile # Multi-stage Docker image
├── docker-compose.yml # Orchestrates app + MongoDB + Redis
├── .env # Environment variables (do not commit secrets)
└── README.md # This file
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Returns a message confirming the app is running |
/health |
GET | Returns health status of the application and all services |
GET /
{
"message": "Application is running 🚀",
"timestamp": "2024-01-01T00:00:00.000Z"
}GET /health
{
"status": "healthy",
"timestamp": "2024-01-01T00:00:00.000Z",
"services": {
"mongodb": { "status": "healthy", "uri": "mongodb://mongo:27017/devopsdb" },
"redis": { "status": "healthy", "url": "redis://redis:6379" }
}
}# 1. Clone / enter the project
cd node-devops-project
# 2. Start all services (app + MongoDB + Redis)
docker-compose up --build
# 3. Test endpoints
curl http://localhost:8090/
curl http://localhost:8090/health
# 4. Stop everything
docker-compose downRequires a running MongoDB and Redis instance on localhost.
# Install dependencies
npm install
# Update .env to point to local services
# MONGO_URI=mongodb://localhost:27017/devopsdb
# REDIS_URL=redis://localhost:6379
# Start the server
npm start
# Development mode (auto-reload)
npm run dev