You can skip this step if you already have Docker installed.
brew cask install docker
If you don't have Homebrew installed (you should), you can download it from Docker's website.
If it's your first time running Docker, open it from Applications, log-in (sign-up) and follow the steps there.
To run the server properly, you will need an .env file with some variables. Our recommendation is to create it with at least this variables:
SALT=11
JWTSECRET=chabon
SERVER_PORT=4000
NODE_ENV=development
POSTGRES_NAME=postgres
POSTGRES_PORT=5432
POSTGRES_PASSWORD=suelings
POSTGRES_USER=suelings
POSTGRES_DB=js-questions-dev
Feel free to change any value as you see fit.
Run the following command from a terminal open in the root directory of the project (where the docker-compose.yml file is)
docker-compose up
This will create a network with a node.js server and a PostgreSQL database. We higly recommend populating the database with the provided mock data, following this steps Execute the server's terminal db:seed
If you'd like to know more about the container have a look at the docker-compose.yml file, it is very well commented.
In case you want to access the container's terminal, run the following command in your local computer:
docker exec -it JSQ-Server /bin/bash
If you have PostgreSQL installed in you machine, run the following command:
psql -h localhost -d js-questions-dev -U suelings
If you DO NOT have PostgreSQL installed in you machine:
docker exec -it postgres psql -U suelings js-questions-dev
Access the index.js file in the root directory and make note of the two commented out lines at the bottom file. If you uncomment them and while running the server, it will drop all the tables and create them back again.
This will leave you with a database so clean that you can eat out of it. Make sure to recomment them back out after it is cleaned
This repository includes a Postman collection to test the API. To install it click the "Import" button on the top left corner of Postman and select the postman-collection.json file of the root directory.
This command is executed as one of the steps of docker's set-up process.
If you reset the database and would like some mock data back in it, this is your command. Run it from the server's terminal (how-to in the first point of the Extras section in this file)
npm run db:seed
Populate the database with mock data. All mock files are inside of /database/mocks.
Amber Williams - GitHub - LinkedIn
Natalia Ortiz - GitHub - LinkedIn