Description
Like most of Parse.com users, I've got multiple applications running in my Parse account. So I was curious to know if there is any way to do this on a self-hosted parse server or not. After trying different approaches (even running independent server per application, which is a crazy idea!) this is my final configuration which make me able to run multiple applications on one parse server:
var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var path = require('path');
var first = new ParseServer({
databaseURI: ' ,.',
appId: ' ,.',
masterKey: ' ,.',
serverURL: 'http://localhost:1400/parse',
cloud: 'cloud/first.js'
});
var second = new ParseServer({
databaseURI: ' ,.',
appId: ' ,.',
masterKey: ' ,.',
serverURL: 'http://localhost:1400/parse',
cloud: 'cloud/second.js'
});
var app = express();
app.use('/parse', first);
app.use('/parse', second);
var port = 1400;
var httpServer = require('http').createServer(app);
httpServer.listen(port, 'localhost');
With this configuration inside index.js file, I was able to make both application running on https://mydomain.com/parse and each could be authorized using their own appId and masterKey. Even Cloud Code for each application is working without any problem.
The point is that, why this ability isn't officially documented? Parse developers are saying that running multiple applications on same server isn't supported (Even when I want to run parse-server with terminal command and a configuration for multiple applications, I get an error saying running multiple applications isn't supported). But as I said, I was able to this by editing index.js file in source code like above.
All of these things make me think that I'm missing something. Am I?!