Instructions:
0 - Run npm install
1 - Database setup:
Fire up PgAdmin (or your preferred localhost DB tool) // or use the credentials of a hosted database
Create two databases - one for development, one for testing
Create a .env file in the root directory of the backend with the following content
PORT =
SECRET =
DB_USERNAME =
DB_PASSWORD =
HOST =
DB_PORT =
DATABASE =
TEST_DATABASE =
Populate the .env file according to your liking (PORT, SECRET) & with the connection parameters of the databases that you want to connect to
Create a config file in the config folder (config/config.json) with the following content, and populate it with the same credentials
Note - referencing the .env file does not work here. This is a dependency of the Sequelize CLI for handling the migrations
{
"development": {
"username": ,
"password": ,
"database": ,
"host":
"port":,
"dialect":
},
"test": {
"username": ,
"password": ,
"database": ,
"host": ,
"port":,
"dialect":
},
"production": {
"username": "root",
"password": null,
"database": "database_production",
"host": "127.0.0.1",
"port": 1234,
"dialect": "postgres"
}
}
2 - Run the migrations (create the DB tables):
npm run db:migrate
npm run db:migrate:test
3 - Run the tests:
npm run test
4 - Fire up the backend:
npm run dev