-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathserver.js
More file actions
28 lines (20 loc) · 681 Bytes
/
server.js
File metadata and controls
28 lines (20 loc) · 681 Bytes
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
'use strict';
const config = require('./config/config');
const NodeService = require('./src/services/common/node-service');
const { example } = config;
if (!example) throw new Error('configuration cannot be null/undefined');
const PORT = example.port;
const express = require('express');
const path = require('path');
const app = express();
// Configure static resources
app.use(express.static(path.join(__dirname, '/docs')));
// Configure server-side routing
app.get('*', (req, res) => {
const dist = path.join(__dirname, '/docs/index.html');
res.sendFile(dist);
});
// Open socket
app.listen(PORT, () => {
console.log(`Started Express server on port ${PORT}`);
});