Skip to content

Commit 095122a

Browse files
committed
Merge remote-tracking branch 'parse/master'
Conflicts: README.md index.js
2 parents dcb5b41 + 7ef5967 commit 095122a

File tree

7 files changed

+67
-6
lines changed

7 files changed

+67
-6
lines changed

.ebextensions/app.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ option_settings:
55
MASTER_KEY: "ReplaceWithMasterKey"
66
DATABASE_URI: "ReplaceWithDatabaseURI"
77
NODE_ENV: "production"
8-
8+
SERVER_URL: "http://myappname.elasticbeanstalk.com/parse"
99
aws:elasticbeanstalk:container:nodejs:
1010
NodeCommand: "npm start"

README.md

+36-1
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,23 @@ $ git push origin master
321321
A detailed tutorial is available here:
322322
[Azure welcomes Parse developers](https://azure.microsoft.com/en-us/blog/azure-welcomes-parse-developers/)
323323

324+
325+
### Getting Started With Google App Engine
326+
327+
1. Clone the repo and change directory to it
328+
1. Create a project in the [Google Cloud Platform Console](https://console.cloud.google.com/).
329+
1. [Enable billing](https://console.cloud.google.com/project/_/settings) for your project.
330+
1. Install the [Google Cloud SDK](https://cloud.google.com/sdk/).
331+
1. Setup a MongoDB server. You have a few options:
332+
1. Create a Google Compute Engine virtual machine with [MongoDB pre-installed](https://cloud.google.com/launcher/?q=mongodb).
333+
1. Use [MongoLab](https://mongolab.com/google/) to create a free MongoDB deployment on Google Cloud Platform.
334+
1. Modify `app.yaml` to update your environment variables.
335+
1. Delete `Dockerfile`
336+
1. Deploy it with `gcloud preview app deploy`
337+
338+
A detailed tutorial is available here:
339+
[Running Parse server on Google App Engine](https://cloud.google.com/nodejs/resources/frameworks/parse-server)
340+
324341
### Getting Started With Scalingo
325342

326343
#### With the Scalingo button
@@ -336,7 +353,7 @@ A detailed tutorial is available here:
336353
* By default it will use a path of /parse for the API routes. To change this, or use older client SDKs, run `scalingo env-set PARSE_MOUNT=/1`
337354
* Deploy it with: `git push scalingo master`
338355

339-
### Using it
356+
# Using it
340357

341358
You can use the REST API, the JavaScript SDK, and any of our open-source SDKs:
342359

@@ -372,6 +389,24 @@ obj.save().then(function(obj) {
372389
}, function(err) { console.log(err); });
373390
```
374391

392+
Example using it on Android:
393+
```
394+
//in your application class
395+
396+
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
397+
.applicationId("myAppId")
398+
.clientKey("myClientKey")
399+
.server("http://myServerUrl/parse/") // '/' important after 'parse'
400+
.build());
401+
402+
ParseObject testObject = new ParseObject("TestObject");
403+
testObject.put("foo", "bar");
404+
testObject.saveInBackground();
405+
406+
```
407+
408+
You can change the server URL in all of the open-source SDKs, but we're releasing new builds which provide initialization time configuration of this property.
409+
375410
## See Also
376411

377412
* https://github.com/ParsePlatform/parse-server

app.json

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
"MASTER_KEY": {
1717
"description": "A key that overrides all permissions. Keep this secret.",
1818
"value": "myMasterKey"
19+
},
20+
"SERVER_URL": {
21+
"description": "URL to connect to your Heroku instance (leave as http://localhost)",
22+
"value": "http://localhost/parse"
1923
}
2024
},
2125
"image": "heroku/nodejs",

app.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
runtime: nodejs
2+
vm: true
3+
4+
env_variables:
5+
# --REQUIRED--
6+
DATABASE_URI: mongodb://localhost:27017/dev
7+
APP_ID: <your-app-id>
8+
MASTER_KEY: <your-master-key>
9+
# --OPTIONAL--
10+
# FILE_KEY: <your-file-key>
11+
# PARSE_MOUNT: /parse
12+
# CLOUD_CODE_MAIN:

azuredeploy.json

+9
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@
4444
"minLength": 1,
4545
"defaultValue": "myMasterKey"
4646
},
47+
"parseServerUrl": {
48+
"type": "string",
49+
"minLength": 1,
50+
"defaultValue": "http://yourappname.azure.com/parse"
51+
},
4752
"repoURL": {
4853
"type": "string",
4954
"defaultValue": "https://github.com/yongjhih/docker-parse-server.git",
@@ -109,6 +114,10 @@
109114
"name": "MASTER_KEY",
110115
"value": "[parameters('parseMasterKey')]"
111116
},
117+
{
118+
"name": "SERVER_URL",
119+
"value": "[parameters('parseServerUrl')]"
120+
},
112121
{
113122
"name": "WEBSITE_NODE_DEFAULT_VERSION",
114123
"value": "4.2.3"

index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var express = require('express');
66
var ParseServer = require('parse-server').ParseServer;
77
var links = require('docker-links').parseLinks(process.env);
88

9-
var databaseUri = process.env.DATABASE_URI || process.env.MONGOLAB_URI
9+
var databaseUri = process.env.DATABASE_URI || process.env.MONGOLAB_URI;
1010

1111
if (!databaseUri) {
1212
if (links.mongo) {
@@ -36,6 +36,7 @@ var api = new ParseServer({
3636

3737
appId: process.env.APP_ID || 'myAppId',
3838
masterKey: process.env.MASTER_KEY, //Add your master key here. Keep it secret!
39+
serverURL: process.env.SERVER_URL || 'http://localhost:1337', // Don't forget to change to https if needed
3940

4041
collectionPrefix: process.env.COLLECTION_PREFIX,
4142
clientKey: process.env.CLIENT_KEY,

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "parse-server-example",
3-
"version": "1.0.0",
3+
"version": "1.2.0",
44
"description": "An example Parse API server using the parse-server module",
55
"main": "index.js",
66
"repository": {
@@ -14,12 +14,12 @@
1414
"express": "~4.2.x",
1515
"kerberos": "~0.0.x",
1616
"parse": "~1.6.12",
17-
"parse-server": "~2.0"
17+
"parse-server": "~2.1.2"
1818
},
1919
"scripts": {
2020
"start": "nodemon --watch /parse/cloud index.js"
2121
},
2222
"engines": {
23-
"node": ">=4.1"
23+
"node": ">=4.3"
2424
}
2525
}

0 commit comments

Comments
 (0)