有没有办法在一个 Node.js(一台机器)环境中运行多个 Parse 服务器实例?如果是的话,配置是什么。
我专门针对 Jelastic,但我认为通用解决方案无论如何都是适用的。
最佳答案
我正在使用这种方式,并且效果很好
// First app instance here
var api1 = new ParseServer({
databaseURI: 'mongodb://localhost:27017/dev1',
cloud: '/home/myApp/cloud/main1.js',
appId: 'myAppId1',
masterKey: 'myMasterKey1',
fileKey: 'optionalFileKey1',
serverURL: 'http://localhost:1337/parse'
});
// Second app instance here
var api2 = new ParseServer({
databaseURI: 'mongodb://localhost:27017/dev2', // Connection string foryour MongoDB database
cloud: '/home/myApp/cloud/main2.js', // Absolute path to your Cloud Code
appId: 'myAppId2',
masterKey: 'myMasterKey2', // Keep this key secret!
fileKey: 'optionalFileKey',
serverURL: 'http://localhost:1337/parse' // Don't forget to change to https if needed
});
// Serve the Parse API on the /parse URL prefix
var mountPath = process.env.PARSE_MOUNT || '/parse';
// Mount Apps here
app.use(mountPath, api1);
app.use(mountPath, api2);
希望这有帮助!让我知道
关于node.js - 在一个 Node.js 环境中运行多个 Parse 服务器实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41265702/