Skip to content

Commit

Permalink
chore(project-setup): set up project
Browse files Browse the repository at this point in the history
-create empty express project
-set up test env
-set up swagger documentation
-set up CI/CD
-set up global error handler
-write comprehensive README
-set up docker

[Finishes #1]
  • Loading branch information
jkarenzi committed Jun 5, 2024
1 parent 9480d15 commit d4845bb
Show file tree
Hide file tree
Showing 21 changed files with 8,662 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/node_modules
/coverage
Dockerfile
.dockerignore
docker-compose.yml
14 changes: 14 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": ["plugin:@typescript-eslint/recommended"],
"env": {
"node": true,
"es6": true
},
"rules": {
"no-console": "warn",
"quotes": ["error", "single"]
},
"ignorePatterns": ["dist/**/*", "__tests__/*"]
}
16 changes: 16 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
**what does this PR do?**


**Description of the task to be completed**


**How can this be manually tested?**


**Swagger documentation screenshot**


**Test screenshot**


**What are the relevant pivotal trackers/story id?**
33 changes: 33 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI for taskMaster Project

on:
push:
branches: ['develop']
pull_request:
branches: ['develop']

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm run test:ci
- run: npm run lint
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: jkarenzi/task-master-be
directory: coverage/
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.env
node_modules/
dist/
coverage/
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "es5"
}
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:latest

WORKDIR /usr/src/app

COPY package*.json ./
RUN npm ci

COPY . .

EXPOSE 3000
CMD ["npm", "run", "dev"]
57 changes: 56 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,56 @@
# task-master-be
# TaskMaster API

[![CI for taskMaster Project](https://github.com/jkarenzi/task-master-be/actions/workflows/CI.yaml/badge.svg)](https://github.com/jkarenzi/task-master-be/actions/workflows/CI.yaml)

[![codecov](https://codecov.io/gh/jkarenzi/task-master-be/graph/badge.svg?token=U0Z9YSSFFH)](https://codecov.io/gh/jkarenzi/task-master-be)

## Overview

Welcome to TaskMaster API! This project provides the backend API for the TaskMastere application. It is a robust task manager that allows users to create, update, style and delete their tasks

## Documentation

Find the API documentation at https://localhost:3000/api-docs

## Installation

To get started with the TaskMaster API, follow these simple steps:

1. **Clone the Repository**:

```bash
git clone https://github.com/jkarenzi/task-master-be.git
```

2. **Install Dependencies**:

```bash
npm install
```

3. **Run the Development Server**:
```bash
npm run dev
```

## Testing

- Run tests

```bash
npm run test
```

- Run tests with coverage

```bash
npm run test:ci
```

## Usage

Once the development server is running, you can interact with the API using HTTP requests.

## Authors

- [Manzi Karenzi](https://github.com/jkarenzi)
20 changes: 20 additions & 0 deletions __tests__/test.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { test } from '../src/controllers/testController';

const res: any = {};

(res.json = jest.fn((x: Object) => x)),
(res.status = jest.fn((x: number) => res));

const req: any = {
body: {
name: 'test',
},
};

describe('Test', () => {
it('should return 200 successful upon testing route', async () => {
await test(req, res);

expect(res.status).toHaveBeenCalledWith(200);
});
});
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '3'
services:
app:
build: .
ports:
- '8000:3000'
volumes:
- .:/usr/src/app
- /usr/src/app/node_modules
env_file:
- .env
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
Loading

0 comments on commit d4845bb

Please sign in to comment.