Tutorial that will teach you how to get started with Parse.
ACL | createdAt | objectId | updatedAt |
---|---|---|---|
There is no data in this class. |
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.
Here are some characteristics of Parse server:
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.