-
Notifications
You must be signed in to change notification settings - Fork 0
Local Environment
If you have cloned the API to your machine and would like to run a local copy for development, there are several steps you need to follow in order to get the API to run.
- As of now, the API is running on heroku. You should start off by making an account here.
- After that, you need to install the heroku toolbelt. This will give you access to things like foreman to help setup a local environment. Read this for more information.
- Once you have heroku setup, create a local file
.envin the root of the API
Sample:
=== project-ps Config Vars
AWS_ACCESS_KEY=###########
AWS_SECRET_ACCESS_KEY==###########
== PRODUCTION ==
== DATABASE_URL==###########
== HEROKU_POSTGRESQL_GOLD_URL=###########
== LOCAL ==
NODE_ENV=dev
DATABASE_URL=[URL_TO_YOUR_LOCAL_DB]
HEROKU_POSTGRESQL_GOLD_URL=[URL_TO_YOUR_LOCAL_DB]
PATH=[PATH_VARS] eg. bin:node_modules/.bin:/usr/local/bin:/usr/bin:/bin
S3_BUCKET_NAME=[YOUR_BUCKET_NAME_ON_S3]
NB: you might need to setup your own Amazon S3 account to save your images.
- Now, run
foreman startto run the server with your local settings from the.envfile.
For those who want to run the API with node-supervisor you will need to add a line to your .env file:
WEB=supervisor api/web.js
With that in place, to run the API, you can start foreman with the .env file as follows: foreman start -e [YOUR_ENV_FILE]
Now as you edit your .js files, your server will be restarted with the new changes.
If you want to use the Google Chrome plugin: Postman, here are some collections that I made to test each of the resources:
http://www.getpostman.com/collections/2adb243cc797686c2c6a
http://www.getpostman.com/collections/17a48cb64d9ffdf21293
http://www.getpostman.com/collections/f714c01a3d8e37a71d19
http://www.getpostman.com/collections/ff72db45c07353813551
Unit testing is done using
To run the unit tests, from the root of the project directory (/projectPS) simply run:
foreman run mocha test