Backend code for Streetmix
Development setup (on Mac OS X 10.8)
First-time setup
-
Download and install Node.js.
brew install nodejs
-
Download, install and start MongoDB.
brew install mongodb
-
Download and install Coreutils.
brew install coreutils
-
Clone this repository to a folder on your computer. The rest of this document will refer to this folder as
$PROJECT_ROOT
. -
Install project dependencies.
cd $PROJECT_ROOT npm install
Every time you sync $PROJECT_ROOT with the remote GitHub repo
-
Update the project dependencies.
cd $PROJECT_ROOT npm install
To start the REST API server
- Setup environment variables.
Variable name | Description | Required? |
---|---|---|
SENDGRID_USERNAME |
Your SendGrid username | Yes |
SENDGRID_PASSWORD |
Your SendGrid password | Yes |
TWITTER_OAUTH_CONSUMER_KEY |
Development Twitter OAuth consumer key, obtained from @streetmixapp Twitter account | Yes |
TWITTER_OAUTH_CONSUMER_SECRET |
Development Twitter OAuth consumer secret, obtained from @streetmixapp Twitter account | Yes |
PORT |
HTTP port for REST API server | No; default = 8080 |
-
Start the REST API server.
cd $PROJECT_ROOT npm start
Project folder structure
$PROJECT_ROOT
: Folder to which this repository was cloned.
└config
: Folder containing configuration files for the application.
└models
: Folder containing models that let the application communicate with the data store.
└restapi
: Folder containing code for the REST API server, resources and documentation.