You will need to setup the project by following these steps:
- Clone the repository:
git clone- Install the dependencies:
npm install- Create a .env file at the root of the project and add the following environment variables:
PORT=3000
PG_URL=postgresql://postgres:postgres@localhost:5432/playground
JWT_SECRET=SECRETKEYSTRING
DEPLOY_URL=http://localhost:3000
SESSION_SECRET=SECRETKEYSTRING
MONGO_URL=mongodb://localhost:27017/playground-session
ENV=DEV- PORT: The port on which the server will run.
- PG_URL: The URI of the PostgreSQL database.
- JWT_SECRET: The secret key used to sign the JWT tokens.
- DEPLOY_URL: The URL of the server. ACTUALLY NOT USED
- SESSION_SECRET: The secret key used to sign the session cookies.
- SESSION_SECRET_STATS: The secret key used to keep data.
- MONGO_URL: The URI of the MongoDB server.
- ENV: The environment in which the server is running (DEV, PROD). It is used to enable/disable some features about sequelize logging and ssl.
- Run the server:
npm start- The server should now be running on the specified port.
This project uses a PostgreSQL database. You can set up a local database by following these steps:
- Use the following script to create a new database and add tables to it :
npm run db:create- Use the following script to populate the database with data :
npm run db:seed- Use the following script to drop the database :
npm run db:drop- Use the following script to reset (drop, create and populate) the database :
npm run db:reset && npm run db:seedMongoDB is used for the admin authentication. You can run a local MongoDB server by following these steps:
-
Install MongoDB on your machine.
-
Run the following command to start the MongoDB server:
mongod- Set the URI of the MongoDB server in the .env file:
MONGO_URL=mongodb://localhost:27017/playground-sessionAdministrator dashboard is usable at localhost:PORT/.
To deploy the server on heroku, you will need to follow these steps:
- setup a PG database on heroku
- setup a MongoDB database on heroku
- setup a heroku app
- set the environment variables on heroku
- push the code to heroku using git or heroku CLI :
git push heroku master