Install or Update the Xcode application:
- Open the Mac OSX App Store, search for Xcode, and install it, or update it if that option is shown. It is a > 9GB download so expect some time.
- Once it's downloaded, open the Xcode app, agreed to the end-user license agreement, enter your password as prompted, and allow the components to download.
Clone down both repos inside one parent directory:
CD into the front-end directory.
Install NVM (Node Version Manager, like rbenv for Node):
- From the command line, run
brew install nvm
. - Add the recommended setup code to your
.bash_profile
or.zshrc
file in your root directory:export NVM_DIR="$HOME/.nvm" [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
- After adding those lines to your Bash or ZSH profile, restart your Terminal (or other terminal app) so that the new lines take effect.
Install the most recent stable version of Node:
- Visit nodejs.org and look at the version shown on the "LTS" button to the left.
- Install that version of Node.js by running
nvm install #.#.#
with the actual version numbers in place of#
.
Run npm install
to install the JavaScript libraries needed to run the front-end server, in both the front-end and back-end directories.
You will see lots of warnings, and can ignore them unless it ends with mentioning errors. If you encounter errors, please contact the Paired dev team and/or submit your problem as an Issue on the relevant repo.
Before starting front-end:
- Open project in Atom
- Open
src/utils/index.js
file - Change the
url
value on the second line fromhttps://paired-api.herokuapp.com/graphql
(the live, actual, functioning GraphQL endpoint which will change live data) to the following which will point to your locally-deployed back-end:http://localhost:3001/graphql
Run npm start
to deploy the front-end server. Your browser should open automatically to localhost:3000
. You will need to have the back-end running for the site to function; see below.
Follow the above instructions to install nvm
, node
, and npm
, then run npm install
in the back-end repo's root directory if you have not already.
Install MongoDB Community Server
In the paired-api
directory, run MongoDB as a Mac OSX service with this command (rather than mongod
):
brew services start mongodb-community
Optionally, seed the database:
npm run seed
Then start the server with this command:
npm run server
You can now run the front-end server and have it function in conjunction with the front-end. Additionally, you can visit http://localhost:3001/graphql
to use the GraphQL Playground.
To use the MongoDB GUI (similar to using Postico for PostgreSQL):
- Go to the MongoDB Community Compass website
- Select "Community Edition Stable" from drop-down "Version" menu.
- Download, install, and run the app.
- Click "Fill in connection fields individually," then click "Connect" with no fields changed.
Type Control-C to stop the server, and enter the following to stop MongoDB:
brew services stop mongodb-community
To run the front-end test suite with Jest, run:
npm run test:dev
You may need to update the "snapshots" by pressing u
at the menu that appears after the test suite has run.
To run the back-end test suite, after starting MongoDB enter the following:
npm run test:dev
When running either test suite, you may see a message that no files have been changed since the test was last run. You can press 'a' to bypass this message and run the test suite, and otherwise interact with the test application through the text menus by pressing the prompted keys.