Skip to content

Instantly share code, notes, and snippets.

@cyrilchandelier
Created October 12, 2016 21:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cyrilchandelier/59527d81b682b7d514001b4ff17e96c1 to your computer and use it in GitHub Desktop.
Save cyrilchandelier/59527d81b682b7d514001b4ff17e96c1 to your computer and use it in GitHub Desktop.
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