Skip to content

Add a Heroku Button #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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