This project uses or depends on software from
- NodeJS https://nodejs.org/
- Express https://github.com/expressjs
- MYSQL
- PM2 http://pm2.keymetrics.io/
- TypeScript https://www.typescriptlang.org/
- Sequelize http://docs.sequelizejs.com/
This project uses the following Style Guidelines
.
├── 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
├── LICENSE
├── README.md
└── tsconfig # Config file for typescript
.
├── ...
├── 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.
└── ...
cd cve-id-allocation-service-prototype
npm install
./node_modules/pm2/bin/pm2 install typescript
See https://dev.mysql.com/doc/mysql-getting-started/en/
This config file is used to config variables for MySQL
See src/config/example-config.json Example
This env file contains important variables needed.
See .env-example for an example
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
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
- ApiDoc http://apidocjs.com/
In order to Create API Docs run:
npm run docs
This creates an html file that can be found under apidocs/
This project uses the following for unit testing
In order to run unit tests, use the following command:
npm run start:test
To view logs:
pm2 logs
To stop the server
pm2 stop all