Setting Up Backend

Cloning the repository

Clone the repository available at https://github.com/coronasafe/superhero_frontend

git clone https://github.com/coronasafe/superhero_frontend.git

Setting up the database

In src/config/config.js

{
  "db": {
    "development": {
      "username": "",
      "password": "",
      "database": "",
      "host": "",
      "dialect": "postgres",
      "port": 5432
    },
    "staging": {
      "username": "",
      "password": "",
      "database": "",
      "host": "",
      "dialect": "postgres",
      "port": 5432
    },
    "production": {
      "username": "",
      "password": "",
      "database": "",
      "host": "",
      "dialect": "postgres",
      "port": 5432
    },
    "staging_heroku": {
      "username": "",
      "password": "",
      "database": "",
      "host": "",
      "dialect": "postgres",
      "port": 5432
    }
  },
  "env": {
    "HOST": "",
    "JWT_SECRET": "",
    "KCC_GMAPS_API_KEY" : "",
    "NODE_ENV": "production"
  }
}

Add database credentials corresponding to each stage.

Only Relational databases supported by Sequelize ORM can be used.

Set NODE_ENV to correct stage before deployment or remove this key and set it for each server.

Set KCC_GMAPS_API_KEY to your Google Maps API Key

Copy your Firebase Service Account JSON to src/keys

In src/utils/fcm.js

const serviceAccount = require("../keys/");

admin.initializeApp({
  credential: admin.credential.cert(serviceAccount),
  databaseURL: ""
});

Add Firebase serviceAccount file and database URL

Go to the root directory of the project

Run npm install and npm start

Last updated