forked from RunOnFlux/flux
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
45 lines (37 loc) · 1.49 KB
/
Copy pathapp.js
File metadata and controls
45 lines (37 loc) · 1.49 KB
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
process.env.NODE_CONFIG_DIR = `${__dirname}/ZelBack/config/`;
// Flux configuration
const config = require('config');
const compression = require('compression');
// const fs = require('fs');
// const https = require('https');
const path = require('path');
const express = require('express');
const app = require('./ZelBack/src/lib/server');
const log = require('./ZelBack/src/lib/log');
const serviceManager = require('./ZelBack/src/services/serviceManager');
// const key = fs.readFileSync(path.join(__dirname, './certs/selfsigned.key'), 'utf8');
// const cert = fs.readFileSync(path.join(__dirname, './certs/selfsigned.crt'), 'utf8');
// const credentials = { key, cert };
// const httpsServer = https.createServer(credentials, app);
// httpsServer.listen(config.server.apiporthttps, () => {
// log.info(`Flux https listening on port ${config.server.apiporthttps}!`);
// });
app.listen(config.server.apiport, () => {
log.info(`Flux running on port ${config.server.apiport}!`);
serviceManager.startFluxFunctions();
});
// Flux Home configuration
const home = path.join(__dirname, './HomeUI/dist');
const homeApp = express();
homeApp.use(compression());
homeApp.use(express.static(home));
homeApp.get('/robots.txt', (req, res) => {
res.type('text/plain');
res.send('User-agent: *\nDisallow: /');
});
homeApp.get('*', (req, res) => {
res.sendFile(path.join(home, 'index.html'));
});
homeApp.listen(config.server.homeport, () => {
log.info(`Flux Home running on port ${config.server.homeport}!`);
});