Skip to content

Commit a72b743

Browse files
committed
Merge pull request #8 from mattcreager/bring-the-button
Add a Heroku Button
2 parents 3414558 + b34e7f5 commit a72b743

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@ Read the full server guide here: https://parse.com/docs/server/guide
1818

1919
### Getting Started With Heroku + Mongolab Development
2020

21+
#### With the Heroku Button
22+
23+
[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy)
24+
25+
#### Without It
26+
2127
* Clone the repo and change directory to it
22-
* Use the Heroku Toolbelt to log in and prepare the app
23-
* Use the MongoLab addon: `heroku addons:create mongolab:sandbox`
24-
* Use `heroku config` and note the URI provided by MongoLab under the var MONGOLAB_URI
25-
* Copy this URI and set it as a new config variable: `heroku config:set DATABASE_URI=mongodb://...`
28+
* Log in with the [Heroku Toolbelt](https://toolbelt.heroku.com/) and create an app: `heroku create`
29+
* Use the [MongoLab addon](https://elements.heroku.com/addons/mongolab): `heroku addons:create mongolab:sandbox`
2630
* 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`
2731
* Deploy it with: `git push heroku master`
2832

app.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "Parse Server Example",
3+
"description": "An example Parse API server using the parse-server module",
4+
"repository": "https://github.com/ParsePlatform/parse-server-example",
5+
"logo": "https://avatars0.githubusercontent.com/u/1294580?v=3&s=200",
6+
"keywords": ["node", "express", "parse"],
7+
"env": {
8+
"PARSE_MOUNT": {
9+
"description": "Configure Parse API route.",
10+
"value": "/parse"
11+
},
12+
"APP_ID": {
13+
"description": "A unique identifier for your app.",
14+
"value": "myAppId"
15+
},
16+
"MASTER_KEY": {
17+
"description": "A key that overrides all permissions. Keep this secret.",
18+
"value": "myMasterKey"
19+
}
20+
},
21+
"image": "heroku/nodejs",
22+
"addons": ["mongolab"]
23+
}

index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ var express = require('express');
55
var ParseServer = require('parse-server').ParseServer;
66
var http = require('http');
77

8-
if (!process.env.DATABASE_URI) {
8+
var databaseUri = process.env.DATABASE_URI || process.env.MONGOLAB_URI
9+
10+
if (!databaseUri) {
911
console.log('DATABASE_URI not specified, falling back to localhost.');
1012
}
1113

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

0 commit comments

Comments
 (0)