Skip to content

Instantly share code, notes, and snippets.

@niraj-shah
Created January 31, 2016 14:06
Show Gist options
  • Save niraj-shah/e1b4f8241e255c4e7894 to your computer and use it in GitHub Desktop.
Save niraj-shah/e1b4f8241e255c4e7894 to your computer and use it in GitHub Desktop.
Parse Server Express App
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