pupilfirst / wd301-api

API used in WD301 course.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wd301-api

API server for WD301

steps to run locally

npm install
npm start

Running in production

  • 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

HTTPS support

You can use Nginx or any other reverse proxy to terminate any SSL connections.

About

API used in WD301 course.


Languages

Language:JavaScript 98.9%Language:EJS 0.8%Language:CSS 0.3%