-
Notifications
You must be signed in to change notification settings - Fork 12
/
app.js
41 lines (33 loc) · 1.35 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var express = require('express');
// config
var config = {};
if(process.env.app) {
config = require('./configs/'+process.env.app);
}
if(!config.enable) {
console.log(config.app+" is disabled!");
return false;
}
var globalConfig = require('./config.json');
// parse server s3 adapter
var S3Adapter = require('parse-server-s3-adapter');
// parse server
var ParseServer = require('parse-server').ParseServer;
var appParseServer = express();
var api = new ParseServer({
appName:config.app,
databaseURI: config.parseServer.databaseURI, // Connection string for your MongoDB database
collectionPrefix:config.useCollectionPrefix?config.parseServer.appId:undefined,
cloud: config.parseServer.cloud, // Absolute path to your Cloud Code
appId: config.parseServer.appId,
masterKey: config.parseServer.masterKey, // Keep this key secret!
serverURL: config.serverURL+":"+config.parseServer.port+"/", // Don't forget to change to https if needed
publicServerURL: config.publicServerURL+"/",
logsFolder:'./logs/'+config.app+"/",
filesAdapter: (process.env.AWS_ACCESS_KEY_ID ? new S3Adapter(globalConfig.S3FilesAdapter.bucket) : null)
});
appParseServer.use('/', api);
appParseServer.listen(config.parseServer.port, function() {
console.log('parse-server running on port '+config.parseServer.port);
});
module.exports = appParseServer;