How to install a Parse Server on a Cloud Server
A few years ago Parse.com backend service was a big deal . It’s pure simplicity made it quite popular for mobile and web applications backend, but since 2017 the service was shut down, and Parse Server was born as an open source, self hosted solution.
In this article we’ll provide you the steps to setup your own Parse Server on CloudBalkan. You can use it as a simple yet very scalable and robust backend for your applications.
Prerequisites
Parse Server runs upon NodeJS and MongoDB so you’ll need these two to begin. You can find the step for installing NodeJS in the article Setting up NodeJS on your Ubuntu Server.
Installation
Installing Parse Server is pretty clean an simple using npm:
npm install -g parse-server
If you don’t have a seperate MongoDB installation you can also run locally using the ‘mongodb-runner’ package:
npm install -g mongodb-runner
mongodb-runner start
To start your Parse Server you just need to run the following line:
parse-server –appId APPLICATION_ID –masterKey MASTER_KEY –databaseURI mongodb://localhost/test
If you’re using a remote MongoDB instance change the ‘databaseURI’ parameter.
The ‘APPLICATION_ID’ is just a string used to later authenticate your requests.
Testing your Parse Server
By default Parse Server will start listening on port 1337, so you can simple send requests to your servers IP address with that port.
ex.
curl -X POST \ -H "X-Parse-Application-Id: APPLICATION_ID" \ -H "Content-Type: application/json" \ -d '{"Cloud": "Balkan"}' \ http://your.server.ip.address:1337/parse/classes/Servers
In response you will get:
{ "objectId": "ati9mKjPcN", "createdAt": "2018-03-01T20:43:09.546Z" }
You can later retrieve the object by that objectId.
curl -X GET \
-H "X-Parse-Application-Id: APPLICATION_ID" \
http://your.server.ip.address:1337/parse/classes/Servers/ati9mKjPcN
You see that Parse is really simple to start.