With Parse’s epic announcement that they are shutting down their server in a year and that they open sourced the server portion that works with the exisiting iOS SDK’s - I need to figure out how to move an app I’m developing from Parse to Parse Server on Heroku. Here’s the steps I did to get a basic app up and running.
Setup
brew update
brew upgrade
brew install node
brew install mongodb
Node Server
cd MyAwesomeServer
git init
touch app.js
npm init
npm install parse-server --save
var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var app = express();
var api = new ParseServer({
databaseURI: 'mongodb://localhost:27017/dev',
appId: 'myAppId',
masterKey: 'mySecretMasterKey',
clientKey: 'someKeyForClients',
});
// Any calls to server address/parse will use Parse Server
app.use('/parse', api)
// Basic response
app.get('/', function(request, response) {
response.status(200).send('Express Server is running');
});
var port = process.env.PORT || 9001;
app.listen(port, function() {
console.log('myawesomeserver running on port: ' + port);
});
node app.js
"start": "node app.js",
to the scripts dictionaryMongoDB
iOS App
pod 'Parse', '~> 1.12.0'
Parse.initializeWithConfiguration(ParseClientConfiguration(block: { (configuration: ParseMutableClientConfiguration) -> Void in
configuration.applicationId = "myAppId"
configuration.clientKey = "someKeyForClients"
configuration.server = "http://localhost:9001/parse"
}))
let myCar = PFObject(className: "Car")
myCar["color"] = "green"
myCar.saveInBackground()
You might get some errors about App Transport Security - its easy to fix Stackoverflow
Verify on MongoLab that the data was saved correctly
Heroku
brew install heroku-toolbelt
heroku login
git add .
git commit -m "Some Message"
heroku create myawesomeapp
git push heroku master
Woo!