The Database Hub | Back4App
The Database Hub | Back4App
How it works
  • Log In
  • Sign Up

  1. Back4App
  2. Parse
Public

16
308
16
308
  • DatabaseDatabase
  • GraphQL API PlaygroundAPI Playground
  • Get Started GuideGet Started
  • IssuesIssues
  • ContributorsContributors
  • GraphQL API Playground
    API Playground
    Get Started Guide
    Get Started
    Issues
    Issues
    Contributors
    Contributors

  1. Parse
  2. Getting_Started_With_Parse

Tutorial that will teach you how to get started with Parse.


DataSchema
Get StartedFetch Data
ACLcreatedAtobjectIdupdatedAt
There is no data in this class.
NotesNotes

Getting Started with Parse

Parse server is one of the most amazing open-source parse backend versions which can be deployed to a Node.js based infrastructure. This can be found on GitHub repo with ease.

Characteristics of Parse Server

Here are some characteristics of Parse server:

  • Parse Server doesn’t depend on hosted parse backend.
  • This platform can use MongoDB directly.
  • You can easily migrate existing Parse server application to your infrastructure.
  • You can create and test your application using Node locally. Pre-requisites to know:
  • MongoDB version 3.6
  • Node 8 or newer
  • Python 2.x
  • An infrastructure provider for deployment Set up parse server in current directory The easiest and fastest way to get started is to run Parse server and MongoDB on a local server.

Saving objects

Use the following Bootstrap script to set-up your parse server in the current directory.

$ sh <(curl -fsSL https://raw.githubusercontent.com/parse-community/parse-server/master/bootstrap.sh)
$ npm install -g mongodb-runner
$ mongodb-runner start
$ npm start

Any arbitrary string can be used as your master key and application id. Your clients will use this string to authenticate with the Parse Server. After this you are running a separate parse server version on your machine. Save your first object After running your parse server, this is the time to save your first object. Here we will use a REST API but you can do this with Parse SDKs too.

Here is the code:

curl -X POST \
-H "X-Parse-Application-Id: APPLICATION_ID" \
-H "Content-Type: application/json" \
-d '{"score":123,"playerName":"Sean Plott","cheatMode":false}' \
http://localhost:1337/parse/classes/GameScore

Response of above code:

{
  "objectId": "2ntvSpRGIK",
  "createdAt": "2016-03-11T23:51:48.050Z"
}

You can also retrieve the object directly but replace 2ntvSpRGIK with the object ID you are going to receive after object creation.

$ curl -X GET \
  -H "X-Parse-Application-Id: APPLICATION_ID" \
  http://localhost:1337/parse/classes/GameScore/2ntvSpRGIK

Response

{
  "objectId": "2ntvSpRGIK",
  "score": 123,
  "playerName": "Sean Plott",
  "cheatMode": false,
  "updatedAt": "2016-03-11T23:51:48.050Z",
  "createdAt": "2016-03-11T23:51:48.050Z"
}

Although keeping track of object ids individually is not ideal but in certain situations, you have to run a query over the collection just like:

$ curl -X GET \
  -H "X-Parse-Application-Id: APPLICATION_ID" \
  http://localhost:1337/parse/classes/GameScore

The following response will bring all the matching objects within your “Results” Array:

{
  "results": [
    {
      "objectId": "2ntvSpRGIK",
      "score": 123,
      "playerName": "Sean Plott",
      "cheatMode": false,
      "updatedAt": "2016-03-11T23:51:48.050Z",
      "createdAt": "2016-03-11T23:51:48.050Z"
    }
  ]
}

Connect application to parse server Parse offers SDKs for all of the major platforms. To learn how you can connect your application with parse server, make sure to see the rest of guide. Run your parse server anywhere else Once you have understood how this project works. Go to the section “Deploying Parse Server” to learn some other ways to run parse server.