Skip to content
This repo contains future CVE services
Branch: master
Clone or download
Latest commit 8708592 May 16, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.eslintignore testing May 3, 2019
.eslintrc.js adding linter May 3, 2019
.prettierrc.js adding linter May 3, 2019
LICENSE Initial Commit Mar 27, 2019 adding more comments May 16, 2019


Table of contents


This project uses or depends on software from

Style Guidelines

This project uses the following Style Guidelines

Directory layout

Top Level Directory

├── src                     # Source files (This is where the API resides)
├── test                    # Automated tests (This is where the API tests reside)
├── eslintignore            # Specifly files/folders for linter to ignore
├── eslintignore            # Linter setup. 
├── prettierrc              # Addon for linter setup
├── sequelize               # ORM setup file
└── tsconfig                # Config file for typescript

Src Directory

├── ...
├── src                     # Source files (This is where the API resides)
│   ├── config              # Contains config file for MySQL DB and PM2 configuration
│   ├── controller          # All API logic resides here
│   ├── database            # MySQL ORM models & seeders reside here. Also contains all DB operations
│   ├── middlewares         # Authentication middlewares reside inside this folder. 
│   ├── constants           # Contains constant variables used throughout the application
│   ├── routes              # This is where routes get created and get tied back to their specific controller. 
│   └── index               # Where everything begins.
└── ...


Step 1. Install required node modules

    cd cve-id-allocation-service-prototype
    npm install
    ./node_modules/pm2/bin/pm2 install typescript 

Step 2. Setup MySQL.


Step 3. Edit the src/config/config.json file to suite your requirements

This config file is used to config variables for MySQL
See src/config/example-config.json Example

Step 4. Create a .env file in the root folder

This env file contains important variables needed.
See .env-example for an example

Step 5. Create database and tables

Start the MySQL database

sudo /etc/init.d/mysql start
node_modules/.bin/sequelize db:create
node_modules/.bin/sequelize db:migrate
node_modules/.bin/sequelize db:seed:all

Step 6. Start the node application

In order to start a dev enviorment:

    npm run start:dev

In order to start a test enviorment with unit testing:

    npm run start:test

Api Documentation

In order to Create API Docs run:

npm run docs

This creates an html file that can be found under apidocs/

Unit Testing

This project uses the following for unit testing

In order to run unit tests, use the following command:

npm run start:test

In order to view server logs and to stop server

To view logs:

pm2 logs

To stop the server

pm2 stop all
You can’t perform that action at this time.