-
-
Save cyrilchandelier/59527d81b682b7d514001b4ff17e96c1 to your computer and use it in GitHub Desktop.
Starting several workers running ParseServer on the same machine
This file contains 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 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