This is an example on how to deploy Parse Server on Pivotal Web Services.
- 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
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
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';
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
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 (c) 2016 Pivotal Software Inc. See LICENSE for details.