API server for WD301
npm install
npm start
- Install
pm2
npm install pm2 -g
- Add environment variables to
.env
file (Refer.env.sample
file)
DATABASE_URL="postgres://postgres:postgres@localhost:5432/wd301_db"
PORT=8081
JWT_SECRET="your_jwt_secret"
SALT_ROUNDS=10
- Make sure the database exists
cd wd301-api
NODE_ENV=production npx sequelize-cli db:create
- Run the application
cd wd301-api
NODE_ENV=production pm2 start "npx sequelize-cli db:migrate && npm start" --name wd301-api
- Stopping the application
pm2 stop wd301-api
- You can get the logs for the application by running
pm2 logs
You can use Nginx or any other reverse proxy to terminate any SSL connections.