Example project using the parse-server module on Express.
Read the full Parse Server guide here: https://github.com/ParsePlatform/parse-server/wiki/Parse-Server-Guide
Click the button bellow to quickly and safely install this project on your local machine.
The Run Project
button employs azk
, a lightweight open source orchestration tool that will automatically isolate and configure the application's environment for you.
Learn more about azk
here.
- Make sure you have at least Node 4.3.
node --version
- Clone this repo and change directory to it.
npm install
- Install mongo locally using http://docs.mongodb.org/master/tutorial/install-mongodb-on-os-x/
- Run
mongo
to connect to your database, just to make sure it's working. Once you see a mongo prompt, exit with Control-D - Run the server with:
npm start
- By default it will use a path of /parse for the API routes. To change this, or use older client SDKs, run
export PARSE_MOUNT=/1
before launching the server. - You now have a database named "dev" that contains your Parse data
- Install ngrok and you can test with devices
After you run this project locally using Run Project
button, deploying to DigitalOcean is very simple.
First, be sure you have SSH keys configured in your machine. If you don't have it yet (or if you aren't sure about it), just follow steps 1 and 2 of this tutorial.
Next, put your personal access token into a .env
file:
$ cd path/to/the/project
$ echo "DEPLOY_API_TOKEN=<YOUR-PERSONAL-ACCESS-TOKEN>" >> .env
Then, just run the following:
$ azk deploy
The Run Project
button employs azk
, a lightweight open source orchestration tool that will automatically isolate and configure the application's environment for you.
Find instructions for further resources (mostly customizations) to deploy to DigitalOcean using azk
here.
- Clone the repo and change directory to it
- Log in with the Heroku Toolbelt and create an app:
heroku create
- Use the MongoLab addon:
heroku addons:create mongolab:sandbox
- By default it will use a path of /parse for the API routes. To change this, or use older client SDKs, run
heroku config:set PARSE_MOUNT=/1
- Deploy it with:
git push heroku master
- Clone the repo and change directory to it
- Log in with the AWS Elastic Beanstalk CLI, select a region, and create an app:
eb init
- Create an environment and pass in MongoDB URI, App ID, and Master Key:
eb create --envvars DATABASE_URI=<replace with URI>,APP_ID=<replace with Parse app ID>,MASTER_KEY=<replace with Parse master key>
A detailed tutorial is available here: Azure welcomes Parse developers
- Clone the repo and change directory to it
- Create a project in the Google Cloud Platform Console.
- Enable billing for your project.
- Install the Google Cloud SDK.
- Setup a MongoDB server. You have a few options:
- Create a Google Compute Engine virtual machine with MongoDB pre-installed.
- Use MongoLab to create a free MongoDB deployment on Google Cloud Platform.
- Modify
app.yaml
to update your environment variables. - Delete
Dockerfile
- Deploy it with
gcloud preview app deploy
A detailed tutorial is available here: Running Parse server on Google App Engine
- Clone the repo and change directory to it
- Log in with the Scalingo CLI and create an app:
scalingo create my-parse
- Use the Scalingo MongoDB addon:
scalingo addons-add scalingo-mongodb free
- Setup MongoDB connection string:
scalingo env-set DATABASE_URI='$SCALINGO_MONGO_URL'
- By default it will use a path of /parse for the API routes. To change this, or use older client SDKs, run
scalingo env-set PARSE_MOUNT=/1
- Deploy it with:
git push scalingo master
Before using it, you can access a test page to verify if the basic setup is working fine http://localhost:1337/test. Then you can use the REST API, the JavaScript SDK, and any of our open-source SDKs:
Example request to a server running locally:
curl -X POST \
-H "X-Parse-Application-Id: myAppId" \
-H "Content-Type: application/json" \
-d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' \
http://localhost:1337/parse/classes/GameScore
curl -X POST \
-H "X-Parse-Application-Id: myAppId" \
-H "Content-Type: application/json" \
-d '{}' \
http://localhost:1337/parse/functions/hello
Note: change http://localhost:1337/
to http://parse-server.dev.azk.io
if you are using azk
.
Example using it via JavaScript:
Parse.initialize('myAppId','unused');
Parse.serverURL = 'https://whatever.herokuapp.com';
var obj = new Parse.Object('GameScore');
obj.set('score',1337);
obj.save().then(function(obj) {
console.log(obj.toJSON());
var query = new Parse.Query('GameScore');
query.get(obj.id).then(function(objAgain) {
console.log(objAgain.toJSON());
}, function(err) {console.log(err); });
}, function(err) { console.log(err); });
Example using it on Android:
//in your application class
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
.applicationId("myAppId")
.clientKey("myClientKey")
.server("http://myServerUrl/parse/") // '/' important after 'parse'
.build());
ParseObject testObject = new ParseObject("TestObject");
testObject.put("foo", "bar");
testObject.saveInBackground();
Example using it on iOS (Swift):
//in your AppDelegate
Parse.initializeWithConfiguration(ParseClientConfiguration(block: { (configuration: ParseMutableClientConfiguration) -> Void in
configuration.server = "https://<# Your Server URL #>/parse/" // '/' important after 'parse'
configuration.applicationId = "<# Your APP_ID #>"
configuration.clientKey = "<# Your CLIENT_KEY #>"
}))
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.