forked from liltimtim/parse_server
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
79 lines (77 loc) · 2.62 KB
/
index.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/**
* Basic Node / Express server setup
*
* Installing Parse as middleware on top of express if we later wish to run our own express server in tandem
*/
const express = require('express');
const ParseServer = require('parse-server').ParseServer;
const app = express();
const config = require('./config');
const path = require('path');
const PORT = process.env.PORT || 1337;
const ParseDashboard = require('parse-dashboard');
// const productionDirectoryLocation = __dirname + '/apns_push_certs/production/apns_production.p12';
// const sandboxDirectoryLocation = __dirname + '/apns_push_certs/sandbox/apns_sandbox.p12';
/**
* Parse server options
*/
const options = {
cloud: __dirname + '/cloud/main.js',
databaseURI: config.MONGODB_URI,
appId: config.PARSE_APP_ID,
masterKey: config.PARSE_MASTER_KEY,
serverURL: config.PARSE_SERVER_URL,
clientKey: config.PARSE_CLIENT_KEY,
javascriptKey: config.PARSE_CLIENT_KEY,
// push: {
// ios: [
// //create and support both sandbox and production
// {
// pfx:sandboxDirectoryLocation,
// passphrase: config.APNS_PASSPHRASE,
// bundleId: config.APPLE_BUNDLE_ID,
// production: false
// },
//
// // issue created on github: https://github.com/parse-community/parse-server/issues/3911
// // setting value to true even though its a production cert crashes server
//
// {
// pfx:productionDirectoryLocation,
// passphrase: config.APNS_PASSPHRASE,
// bundleId: config.APPLE_BUNDLE_ID,
// production: false
// }
// ]
// }
}
const api = new ParseServer(options);
// supportedPushLocales added due to this issue: https://github.com/parse-community/parse-dashboard/issues/811
// waiting for fix to upgrade to newest package
const dashboard = new ParseDashboard({
apps: [
{
serverURL: config.PARSE_SERVER_URL,
appId: config.PARSE_APP_ID,
masterKey: config.PARSE_MASTER_KEY,
appName: config.PARSE_DASHBOARD_APP_NAME,
javascriptKey: config.PARSE_CLIENT_KEY,
clientKey: config.PARSE_CLIENT_KEY,
supportedPushLocales: []
}
],
users: [
{
user: config.PARSE_ADMIN_USERNAME,
pass: config.PARSE_ADMIN_PASSWORD
}
]
}, {
allowInsecureHTTP: true
});
// server up parse api
app.use(config.PARSE_SERVER_MOUNT, api);
app.use('/dashboard', dashboard);
app.listen(PORT, () => {
console.log(`parse server running on ${PORT}`);
});