-
Notifications
You must be signed in to change notification settings - Fork 312
/
Copy pathapp.js
38 lines (31 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
process.env.NODE_CONFIG_DIR = `${__dirname}/ZelBack/config/`;
// ZelBack configuration
const config = require('config');
// const fs = require('fs');
// const https = require('https');
const path = require('path');
const express = require('express');
const app = require('./ZelBack/src/lib/server.js');
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(`ZelBack https listening on port ${config.server.apiporthttps}!`);
// });
app.listen(config.server.apiport, () => {
log.info(`ZelBack running on port ${config.server.apiport}!`);
serviceManager.startFluxFunctions();
});
// ZelFront configuration
const zelfront = path.join(__dirname, './ZelFront/dist');
const ZelFrontApp = express();
ZelFrontApp.use(express.static(zelfront));
ZelFrontApp.get('*', (req, res) => {
res.sendFile(path.join(zelfront, 'index.html'));
});
ZelFrontApp.listen(config.server.zelfrontport, () => {
log.info(`ZelFront running on port ${config.server.zelfrontport}!`);
});