CST2-Backend is the backend API for the Museum database frontend.
Using ExpressJS the API is using the Restful API standard.
Node version requirement
version >= 14.17.6
- Install packages
npm install
- Environmental variables
- create a '.env' file in the source directory
# located in ./.env
# env format
HOST = 'MYSQL-HOST'
SQLUSER = 'MYSQL-USER'
PASSWORD = 'MYSQL-PASSWORD'
DATABASE = 'MYSQL-DB'
PORT = 'OPTIONAL-DEV-PORT-HERE (Remove line if production)'
TOKEN_SECRET = 'JWT-SECRET-HERE'
Secret tokens can be generated with the node hash function below:
require('crypto').randomBytes(64).toString('hex')
- Start Application
- To start as developer (Uses nodemon)
npm run start:dev
- Production
npm start