Created
January 31, 2016 14:06
-
-
Save niraj-shah/e1b4f8241e255c4e7894 to your computer and use it in GitHub Desktop.
Parse Server Express App
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var ParseServer = require('parse-server').ParseServer; | |
var app = express(); | |
// Specify the connection string for your mongodb database | |
// and the location to your Parse cloud code | |
var api = new ParseServer({ | |
databaseURI: 'mongodb://localhost:27017/myapp', | |
appId: '{YOUR_APP_ID}', | |
masterKey: '{YOUR_APP_MASTER_KEY}', | |
fileKey: 'optionalFileKey' | |
}); | |
// Serve the Parse API on the /parse URL prefix | |
app.use('/parse', api); | |
// Hello world | |
app.get('/', function(req, res) { | |
res.status(200).send('Express is running here.'); | |
}); | |
var port = process.env.PORT || 1377; | |
app.listen(port, function() { | |
console.log('Parse Server running on port ' + port + '.'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment