This is the backend of the Class Management project.
Run npm i
to install all the packages for the project. Current node version in use: v18.12.0
Please check the file .env.example
file to create the local .env
file to run the server.
The database config will be based on the the environment variable NODE_ENV
.
Required environment variables to run the server are:
SECRET_KEY
, used for JWT AuthenticationTOKEN_EXPIRETIME
, expire tokenAPP_HOST
, host connect to applicationAPP_PORT
, port connect to applicationDB_HOST
, host DBDB_NAME
, name DBDB_USER
, username DBDB_PASS
, password DB
In development, you can make change to the src/config/config.ts
file to connect to your developement database.
Run npm run dev
to spin up the development environment. The default endpoint will be http://localhost:3000
.
The port can be changed by including the environment variable PORT
.
The database connnection config can be changed in src/config
folder.
Run npm run prod
to start the server. The start script will automatically build, and spin up the server.
When running the app in production, databases environment need to be set to be connected to the database. You need to set database variables including DB_USER
, DB_PASS
, DB_NAME
, DB_HOST
Run npx sequelize-cli db:migrate
to run all pending migrations. The script will build the files and then run the migrations .
The migrations will be used to create and update table models.