This is an example project using the Parse Server module on Express.
The Parse Server guide is a good place to get started. An API reference and Cloud Code guide are also available. If you're interested in developing for Parse Server, the Development guide will help you get set up. All documentations for Parse Platform's server and its client SDKs are available at parseplatform.org.
node --version
to see your local Node.js version. Open the package.json
file too see which version of Node.js this example repository requires at { engines": { "node": "<NODE_VERSION>" } }
. Note that there may be other Parse Server version available that support older or newer Node.js versions, see the Parse Server compatibility table.npm install
.mongo
to connect to your database, just to make sure it's working. Once you see a mongo prompt, exit with Control-D
.npm start
./parse
as a base. You can change this by setting the environment variable PARSE_MOUNT
, for example in the CLI run run export PARSE_MOUNT=/app
to set the path to app
.dev
in which the data is stored that you manage via Parse Server.These scripts can help you to develop your app for Parse Server:
npm run watch
will start your Parse Server and restart if you make any changes.npm run lint
will check the linting of your cloud code, tests and index.js
, as defined in .eslintrc.json
.npm run lint-fix
will attempt fix the linting of your cloud code, tests and index.js
.npm run prettier
will help improve the formatting and layout of your cloud code, tests and index.js
, as defined in .prettierrc
.npm run test
will run any tests that are written in /spec
.npm run coverage
will run tests and check coverage. Output is available in the /coverage
folder.Alternatively, to deploy manually:
heroku create
heroku addons:create mongolab:sandbox --app YourAppName
heroku config:set PARSE_MOUNT=/1
git push heroku master
Alternatively, deploy your local changes manually:
eb init
eb create --envvars DATABASE_URI=<replace with URI>,APP_ID=<replace with Parse app ID>,MASTER_KEY=<replace with Parse master key>
Detailed information is available here:
app.yaml
to update your environment variables.Dockerfile
gcloud preview app deploy
A detailed tutorial is available here: Running Parse server on Google App Engine
Alternatively, to deploy manually:
scalingo create my-parse
scalingo addons-add scalingo-mongodb free
scalingo env-set DATABASE_URI='$SCALINGO_MONGO_URL'
scalingo env-set PARSE_MOUNT=/1
git push scalingo master
oc create -f https://raw.githubusercontent.com/ParsePlatform/parse-server-example/master/openshift.json
A detailed tutorial is available here: Running Parse Server on OpenShift Online (Next Gen)
You can use the /health
endpoint to verify that Parse Server is up and running. For example, for local deployment, enter this URL in your browser:
If you deployed Parse Server remotely, change the URL accordingly.
Use the REST API, GraphQL API or any of the Parse SDKs to see Parse Server in action. Parse Server comes with a variety of SDKs to cover most common ecosystems and languages, such as JavaScript, Swift, ObjectiveC and Android just to name a few.
The following shows example requests when interacting with a local deployment of Parse Server. If you deployed Parse Server remotely, change the URL accordingly.
Save object:
curl -X POST \
-H "X-Parse-Application-Id: YOUR_APP_ID" \
-H "Content-Type: application/json" \
-d '{"score":1337}' \
http://localhost:1337/parse/classes/GameScore
Call Cloud Code function:
curl -X POST \
-H "X-Parse-Application-Id: YOUR_APP_ID" \
-H "Content-Type: application/json" \
-d "{}" \
http://localhost:1337/parse/functions/hello
// Initialize SDK
Parse.initialize("YOUR_APP_ID", "unused");
Parse.serverURL = 'http://localhost:1337/parse';
// Save object
const obj = new Parse.Object('GameScore');
obj.set('score',1337);
await obj.save();
// Query object
const query = new Parse.Query('GameScore');
const objAgain = await query.get(obj.id);
// Initialize SDK in the application class
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
.applicationId("YOUR_APP_ID")
.server("http://localhost:1337/parse/") // '/' important after 'parse'
.build());
// Save object
ParseObject obj = new ParseObject("TestObject");
obj.put("foo", "bar");
obj.saveInBackground();
// Initialize SDK in AppDelegate
Parse.initializeWithConfiguration(ParseClientConfiguration(block: {
(configuration: ParseMutableClientConfiguration) -> Void in
configuration.server = "http://localhost:1337/parse/" // '/' important after 'parse'
configuration.applicationId = "YOUR_APP_ID"
}))
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.