Cabal Barefoot Nomad Backend Development
- Clone this repository
- Make sure that you have node.js and npm installed on your machine. For more information refer to node js installation guide
- Install
yarnpackage by runningnpm install -g yarnscript to be able to install project dependencies. - To install project packages run
yarn install.
- Create
.envin project root directory - Open
.env.examplefile to to get project environment variables. - Copy all keys from the
.env.examplefile to.envfile and add values to corresponding keys. These can be obtained from the project administrator.
-
Configuring
.env- Download and install pgAdmin
- Create two databases, one for testing and another for development.
- Copy
DATABASE_DEV_URL=postgres://your_db_user:[email protected]:5432/your_dev_db_nameandDATABASE_TEST_URL=postgres://your_db_user:[email protected]:5432/your_test_db_nameURLs from.env.exampleto.env - Edit them with your real database user, password and database name.
-
Running Migrations
- Run
yarn dbmigratein terminal to fire up migration
- Run
-
To Undo Migrations
- Run
yarn migrate:undoto undo all migrations
- Run
-
To Reset Migrations
- Run
yarn migrate:resetto reset all migrations.
- Run
-
Running Seeds
- Run
yarn seedingto seed all
- Run
You can run all those scripts with a single script yarn dbmigrate:all
- Run
yarn devto run server locally
- Run
yarn testto run tests
-
Local:
http://localhost:{port}/api-docs/Replace
{port}with the port specified in.envfile. Examplehttp://localhost:5000/api-docs/ -
Remote: