Experimenting with using Node.js and Express to create a rest API.
To get started:
- npm install
- node server/app.js
- Open http://localhost:3000/addresses in your browser
To get heroku setup:
- install the Heroku Toolbelt
- Note that the Procfile has the line that tells Heroku how to run the app:
web: node server/app.js
- Run the following at the command line in the project directory:
heroku login heroku create heroku addons:add mongolab:sandbox
- Anytime you'd like to push your latest change to Heroku run:
git push heroku master
- To scale the app up to one web dyno (so Heroku will run it):
heroku ps:scale web=1
- A nice shortcut for opening the correct heroku url in your browser is:
heroku open
To add a user to MongoDB to use for the app:
- Log into https://dashboard.heroku.com/apps
- Click the app you just created.
- Click MongoLab Sandbox.
- Click the users tab
- Add a user with read and write access with credentials you don't mind putting in the code.