Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-devops-project

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.


Project Structure

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

API Endpoints

Endpoint Method Description
/ GET Returns a message confirming the app is running
/health GET Returns health status of the application and all services

Example responses

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" }
  }
}

Running with Docker Compose (recommended)

# 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 down

Running Locally (without Docker)

Requires 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

About

The objective of this Project is to containerize an existing Node.js application and run it using Docker Compose along with MongoDB and Redis services.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages