Skip to content
Salvatore D'Agositno edited this page Oct 12, 2013 · 5 revisions

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.

Heroku

  • 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 .env in 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 start to run the server with your local settings from the .env file.

Running With Supervisor

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.

Testing

Postman

If you want to use the Google Chrome plugin: Postman, here are some collections that I made to test each of the resources:

Event Invites:

http://www.getpostman.com/collections/2adb243cc797686c2c6a

Events:

http://www.getpostman.com/collections/17a48cb64d9ffdf21293

Photos:

http://www.getpostman.com/collections/f714c01a3d8e37a71d19

Users:

http://www.getpostman.com/collections/ff72db45c07353813551

NB: You might have to change the URL to reflect your local environment

Unit Testing

Unit testing is done using

To run the unit tests, from the root of the project directory (/projectPS) simply run: foreman run mocha test

NB: using foreman will ensure that your .env file is loaded.

Clone this wiki locally