Skip to content

mcpdev0910/mcpmark-cicd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MCPMark CI/CD

A lightweight Node.js Express application demonstrating modern web API development with comprehensive testing and CI/CD practices.

πŸš€ Quick Start

# Install dependencies
npm install

# Run development server
npm run dev

# Run tests
npm test

# Run linting
npm run lint

# Build application
npm run build

πŸ“Š API Endpoints

Health & Status

  • GET / - API information and status
  • GET /health - Health check endpoint
  • GET /status/deployment - Deployment information

Calculator API

  • POST /calculate - Perform mathematical operations
    {
      "operation": "add|subtract|multiply|divide",
      "a": 10,
      "b": 5
    }

User Management

  • GET /users - List all users
  • POST /users - Create new user
    {
      "name": "John Doe",
      "email": "[email protected]"
    }

πŸ§ͺ Testing

The repository includes comprehensive test coverage:

  • Unit Tests: Individual component testing
  • Integration Tests: API endpoint testing
  • Performance Tests: Response time benchmarks
  • Security Tests: Vulnerability scanning
npm test                    # Run all tests
npm run test:watch         # Watch mode
npm run test:coverage      # Coverage report

⚑ Performance Optimized

This application is optimized for fast development and deployment:

  • No Docker builds (pure Node.js)
  • All tests complete in under 30 seconds
  • Lightweight dependencies
  • Fast startup time (< 5 seconds)

πŸ“‹ Available Scripts

Development

npm run dev              # Start development server with auto-reload
npm start               # Start production server
npm test                # Run all tests
npm run test:watch      # Run tests in watch mode
npm run test:coverage   # Generate coverage report

Code Quality

npm run lint            # Check code style and quality
npm run lint:fix        # Auto-fix linting issues
npm run format          # Format code with Prettier

Health Checks

npm run health-check    # Check application health
curl http://localhost:3000/health  # Direct health check

πŸ“ Project Structure

mcpmark-cicd/
β”œβ”€β”€ src/                    # Source code
β”‚   β”œβ”€β”€ app.js             # Main application
β”‚   β”œβ”€β”€ calculator.js      # Calculator utilities
β”‚   └── userService.js     # User management
β”œβ”€β”€ tests/                 # Test files
β”‚   β”œβ”€β”€ api.test.js        # API integration tests
β”‚   β”œβ”€β”€ calculator.test.js # Unit tests
β”‚   └── userService.test.js# Service tests
β”œβ”€β”€ coverage/              # Test coverage reports (generated)
└── package.json          # Dependencies and scripts

πŸ” Features

  • RESTful API: Clean and intuitive API design
  • Input Validation: Comprehensive validation for all endpoints
  • Error Handling: Structured JSON error responses
  • Health Monitoring: Built-in health check endpoints
  • Test Coverage: >90% test coverage
  • Code Quality: ESLint and Prettier integration
  • Performance: Optimized for fast response times

πŸ”§ Development

Adding New Features

  1. Create new endpoint in src/app.js
  2. Write corresponding tests in tests/
  3. Run npm test to verify
  4. Use npm run lint:fix for code style

Testing Strategy

  • Unit Tests: Test individual functions and modules
  • Integration Tests: Test API endpoints end-to-end
  • Validation Tests: Ensure proper input validation
  • Error Handling: Test error scenarios

🚨 Common Issues & Solutions

Port Already in Use

lsof -ti:3000 | xargs kill -9
npm start

Test Failures

npm run lint:fix          # Fix code style issues
npm test -- --verbose     # Get detailed test output

Performance Issues

npm ci                     # Clean install dependencies
npm run test:coverage      # Verify test coverage

πŸ” Monitoring & Observability

  • Health check endpoint: http://localhost:3000/health
  • Deployment status: http://localhost:3000/status/deployment
  • Test coverage: coverage/lcov-report/index.html
  • Memory usage monitoring via health endpoint

πŸ“ API Examples

Calculator Usage

# Addition
curl -X POST http://localhost:3000/calculate \
  -H "Content-Type: application/json" \
  -d '{"operation": "add", "a": 5, "b": 3}'

# Division
curl -X POST http://localhost:3000/calculate \
  -H "Content-Type: application/json" \
  -d '{"operation": "divide", "a": 10, "b": 2}'

User Management

# List users
curl http://localhost:3000/users

# Create user
curl -X POST http://localhost:3000/users \
  -H "Content-Type: application/json" \
  -d '{"name": "Alice Johnson", "email": "[email protected]"}'

Health Monitoring

# Basic health check
curl http://localhost:3000/health

# API information
curl http://localhost:3000/

πŸ“„ License

MIT License - See LICENSE file for details.

🀝 Contributing

  1. Ensure all tests pass: npm test
  2. Maintain code quality: npm run lint
  3. Update documentation if needed
  4. Keep build times under 2 minutes

Modern Node.js | Fast & Lightweight | Production Ready

About

Restored mirror of mcpmark-cicd

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •