Hosting Parse Server on Pivotal Web Services
JavaScript
Switch branches/tags
Nothing to show
Clone or download
frodenas Merge pull request #3 from mattrothenberg/master
Update README with instructions on setting up Live Query support
Latest commit dbf5202 Sep 8, 2016

README.md

Hosting Parse Server on Pivotal Web Services

This is an example on how to deploy Parse Server on Pivotal Web Services.

Deploy

Setup the environment

  • Set Up Your PWS Account (if you don’t have one already)
  • Install the cf CLI
  • Login into PWS and select an org and space:
cf login api.run.pivotal.io

Deploy the Parse Server

Clone this repository to your local workstation and deploy it to PWS:

git clone https://github.com/cf-platform-eng/pws-parse-server
cd pws-parse-server
cf push

Live Query Support

If you wish to use Parse's Live Query feature (e.g., for real-time updates in your application), update server.js with an array indicating the classes for which you would like Live Query support, and create a new instance of the LiveQueryServer object.

var parseServer = new ParseServer({
  ...
  liveQuery: {
    classNames: ["Friends", "Photos"] // List of classes to support for query subscriptions
  }
});

...

var parseLiveQueryServer = ParseServer.createLiveQueryServer(server); // where server is your Express application.

In your client Parse application, specify the URL of your Parse Live Query server, making sure to use the wss protocol and specifying 4443 as the port.

Parse.liveQueryServerURL = 'wss://your-server-url.cfapps.io:4443';

MongoDB backend

Parse Server uses MongoDB as the backend database, so we will need to create a MongoDB database using the PWS service's marketplace and bind it to the application:

cf create-service mongolab sandbox parse-mongodb
cf bind-service parse-server parse-mongodb
cf restage parse-server

Test the Parse Server

Call the Parse Server Cloud function using the REST API:

curl -X POST \
  -H "X-Parse-Application-Id: APP-ID" \
  -H "X-Parse-REST-API-Key: MASTER-KEY" \
  -H "Content-Type: application/json" \
  -d '{}' http://parse-server-<random word>.cfapps.io/parse/functions/hello

Note: replace parse-server-<random word>.cfapps.io with the URL assigned to your application.

Copyright

Copyright (c) 2016 Pivotal Software Inc. See LICENSE for details.