Back-End documentation for installing, setup, usage, of the API.
If you dont have postgres follow this link (Follow directions until you're able to get into psql utility): https://www.codementor.io/engineerapart/getting-started-with-postgresql-on-mac-osx-are8jcopb
In terminal run the following commands:
- "psql" -- To get into postgreSQL utility
- "CREATE DATABASE miracle_be;" -- Creates development server
- "CREATE DATABASE miracle_be_test;" -- Creates testing server
- CD into your miracle-messages-be repo
If you dont have postgres follow this link: https://www.2ndquadrant.com/en/blog/pginstaller-install-postgresql/
To update S3 do the following
- Using the Heroku CLI You may have to use Git BASH as the command is so long
- Command: heroku git:remote -a miracle-messages-dev
- Command: heroku config:set AWS_ACCESS_KEY_ID=xxx AWS_SECRET_ACCESS_KEY=yyy
- Command: heroku config:set S3_BUCKET_NAME=appname-assets
Set up Postgres and create databases for both the development server (miracle_be) and testing server (miracle_be_test)
- Open pgAdmin, sign in with your master password created during the set up of postgres.
- Create a server if needed, if already created, turn server on by right clicking and pressing "Connect Server"
- Once connected, look for the drop down for databases and right click to Create a database
- Create a database called 'miracle_be' for the development connection & (miracle_be_test) for the testing connection
- Make sure in the knexfile.js that both the development and testing servers have their connection set to
Development
connection: {
host: process.env.POSTGRESS_DEV_HOST,
port: process.env.POSTGRESS_DEV_PORT,
user: process.env.POSTGRESS_DEV_USER,
password: process.env.POSTGRESS_DEV_PASSWORD,
database: process.env.POSTGRESS_DEV_DATABASE
},
Testing
connection: {
host: process.env.POSTGRESS_TEST_HOST,
port: process.env.POSTGRESS_TEST_PORT,
user: process.env.POSTGRESS_TEST_USER,
password: process.env.POSTGRESS_TEST_PASSWORD,
database: process.env.POSTGRESS_TEST_DATABASE
},
- Create a .env file and add the following for both DEV and TEST databases
POSTGRESS_DEV_HOST=localhost
POSTGRESS_DEV_PORT=5432
POSTGRESS_DEV_USER=postgres
POSTGRESS_DEV_PASSWORD= \_Insert your postgres password here*
POSTGRESS_DEV_DATABASE=miracle_be
POSTGRESS_TEST_HOST=localhost
POSTGRESS_TEST_PORT=5432
POSTGRESS_TEST_USER=postgres
POSTGRESS_TEST_PASSWORD= \_Insert your postgres password here*
POSTGRESS_TEST_DATABASE=miracle_be_test
- Clone Repo
- "yarn install -- both FE and BE use yarn to avoid conflict"
Migrations/Seeds for Development Environment
- To run migrations: "npx knex migrate:latest"
- To run seed files: "npx knex seed:run"
Migrations/Seeds for Testing Environment
Test database is depricated and not in use
==================== API Docs Start Here:======================= BE API
https://documenter.getpostman.com/view/9765799/SzfDxQme?version=latest
Okta API