-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
40 lines (34 loc) · 1.06 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
'use strict';
var express = require('express');
var app = express();
var ParseServer = require('parse-server').ParseServer;
var ParseDashboard = require('parse-dashboard');
var path = require('path');
var port = process.env.PORT || 1337;
app.use('/pitagoras', new ParseServer({
databaseURI: process.env.MONGODB_URI,
cloud: path.join(__dirname, '/cloud/main.js'),
appId: process.env.APP_ID,
appName: process.env.APP_NAME,
masterKey: process.env.MASTER_KEY,
serverURL: process.env.SERVER_URL,
publicServerURL: process.env.SERVER_URL
}));
var apps = [{
serverURL: process.env.SERVER_URL,
appId: process.env.APP_ID,
masterKey: process.env.MASTER_KEY,
appName: process.env.APP_NAME
}];
// Mount dashboard
app.use('/dashboard', new ParseDashboard({
apps: apps,
users: [{user: 'admin', pass: process.env.DASHBOARD_PASS}]
}));
// Redirect route to dashboard
app.use('/', function (req, res) {
res.redirect('/dashboard');
});
app.listen(port, function () {
console.log('pitagoras-server running on port ' + port + '.');
});