Create a .env
file with your environment variables. For example
APP_NAME=My App
DATABASE_URI=mongodb://localhost:27017/dev
PORT=1337
PARSE_MOUNT=/parse
SERVER_URL=http://localhost
PUBLIC_SERVER_URL=http://localhost:1337
APP_ID=myAppId
MASTER_KEY=myMasterKey
READ_ONLY_MASTER_KEY=readOnlyMasterKey
LOG_LEVEL=7
VERIFY_USER_EMAILS=false
BUNDLE_ID=com.url.appname
FACEBOOK_APP_IDS=someId
EMAIL_DOMAIN=domain.com
EMAIL_API=mailgun-api-key
Then install the dependencies and build/start the server
npm install
npm start // run the server
node dashboard.js // run the dashboard browser (optional)
{
emerg: 0,
alert: 1,
crit: 2,
error: 3,
warning: 4,
notice: 5,
info: 6,
debug: 7
}
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
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")
.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 #>"
}))