Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ci-cd-template/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
extends: 'airbnb-base',
env: {
node: true,
mocha: true,
},
rules: {
'no-console': 'off',
'comma-dangle': ['error', 'always-multiline'],
},
};
28 changes: 28 additions & 0 deletions ci-cd-template/.github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI/CD Pipeline

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: 'npm'

- name: Install Dependencies
run: npm ci

- name: Run Linter
run: npm run lint

- name: Run Tests
run: npm test
5 changes: 5 additions & 0 deletions ci-cd-template/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
.env
.DS_Store
coverage/
*.log
56 changes: 56 additions & 0 deletions ci-cd-template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# CI/CD Ready Node.js API Template

A template for Node.js API projects with CI/CD pipeline using GitHub Actions.

## Features

- Express.js server
- ESLint for code quality
- Mocha & Chai for testing
- GitHub Actions for CI/CD
- Pre-configured scripts

## Getting Started

1. Clone the repository
2. Install dependencies: `npm install`
3. Start development server: `npm run dev`

## Available Scripts

- `npm start` - Start production server
- `npm run dev` - Start development server with nodemon
- `npm test` - Run tests
- `npm run lint` - Run ESLint
- `npm run format` - Format code with ESLint

## CI/CD

The GitHub Actions workflow includes:
- Linting
- Testing
- (Example) Deployment to Vercel/Netlify

## API Endpoints

- `GET /` - Welcome message
- `GET /health` - Health check endpoint

## Testing

Run tests with:
```bash
npm test
```

## Linting

Check code quality with:
```bash
npm run lint
```

Fix linting issues automatically:
```bash
npm run format
```
Loading