Skip to content

Commit

Permalink
Merge pull request BloomBooks#8 from mattcreager/bring-the-button
Browse files Browse the repository at this point in the history
Add a Heroku Button
  • Loading branch information
gfosco committed Feb 1, 2016
2 parents 3414558 + b34e7f5 commit a72b743
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ Read the full server guide here: https://parse.com/docs/server/guide

### Getting Started With Heroku + Mongolab Development

#### With the Heroku Button

[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy)

#### Without It

* Clone the repo and change directory to it
* Use the Heroku Toolbelt to log in and prepare the app
* Use the MongoLab addon: `heroku addons:create mongolab:sandbox`
* Use `heroku config` and note the URI provided by MongoLab under the var MONGOLAB_URI
* Copy this URI and set it as a new config variable: `heroku config:set DATABASE_URI=mongodb://...`
* Log in with the [Heroku Toolbelt](https://toolbelt.heroku.com/) and create an app: `heroku create`
* Use the [MongoLab addon](https://elements.heroku.com/addons/mongolab): `heroku addons:create mongolab:sandbox`
* By default it will use a path of /parse for the API routes. To change this, or use older client SDKs, run `heroku config:set PARSE_MOUNT=/1`
* Deploy it with: `git push heroku master`

Expand Down
23 changes: 23 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "Parse Server Example",
"description": "An example Parse API server using the parse-server module",
"repository": "https://github.com/ParsePlatform/parse-server-example",
"logo": "https://avatars0.githubusercontent.com/u/1294580?v=3&s=200",
"keywords": ["node", "express", "parse"],
"env": {
"PARSE_MOUNT": {
"description": "Configure Parse API route.",
"value": "/parse"
},
"APP_ID": {
"description": "A unique identifier for your app.",
"value": "myAppId"
},
"MASTER_KEY": {
"description": "A key that overrides all permissions. Keep this secret.",
"value": "myMasterKey"
}
},
"image": "heroku/nodejs",
"addons": ["mongolab"]
}
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var http = require('http');

if (!process.env.DATABASE_URI) {
var databaseUri = process.env.DATABASE_URI || process.env.MONGOLAB_URI

if (!databaseUri) {
console.log('DATABASE_URI not specified, falling back to localhost.');
}

var api = new ParseServer({
databaseURI: process.env.DATABASE_URI || 'mongodb://localhost:27017/dev',
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: 'myAppId',
masterKey: 'myMasterKey'
appId: process.env.APP_ID || 'myAppId',
masterKey: process.env.MASTER_KEY || 'myMasterKey'
});
// Client-keys like the javascript key or the .NET key are not necessary with parse-server
// If you wish you require them, you can set them as options in the initialization above:
Expand Down

0 comments on commit a72b743

Please sign in to comment.