-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvivensityServer.js
More file actions
26 lines (22 loc) · 792 Bytes
/
vivensityServer.js
File metadata and controls
26 lines (22 loc) · 792 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
/* eslint-disable */
require('dotenv').config();
const express = require('express');
const path = require('path');
const fs = require('fs');
const PORT = window.__RUNTIME_CONFIG__.PORT || 3000;
const app = express();
app.use(express.static(path.resolve(__dirname, './build')));
app.get('/*', (req, res) => {
const filePath = path.resolve(__dirname, './build', 'index.html');
fs.readFile(filePath, 'utf8', (err, data) => {
if (err) {
return console.log(err);
}
data = data.replace('<title>CurrikiStudio</title>', `<title>${window.__RUNTIME_CONFIG__.META_IMAGE}</title>`);
data = data.replace(/__META_IMAGE__/g, window.__RUNTIME_CONFIG__.META_IMAGE);
res.send(data);
});
});
app.listen(PORT, () => {
console.log(`Server is listening on port ${PORT}`);
});