Skip to content

Instantly share code, notes, and snippets.

@cyrilchandelier

cyrilchandelier/index.js Secret

Created Oct 12, 2016
Embed
What would you like to do?
Starting several workers running ParseServer on the same machine
var throng = require('throng');
var WORKERS = process.env.WEB_CONCURRENCY || 1;
throng({
workers: WORKERS,
lifetime: Infinity,
start: start
});
function start() {
var app = express();
// Serve static assets from the /public folder
app.use('/public', express.static(path.join(__dirname, '/public')));
// Serve the Parse API on the /parse URL prefix
var mountPath = process.env.PARSE_MOUNT || '/parse';
app.use(mountPath, api);
var httpServer = require('http').createServer(app);
var server = httpServer.listen(process.env.PORT || 1337, function() {
console.log('ParseServer running on port %s', server.address().port);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment