-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
34 lines (29 loc) · 966 Bytes
/
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
require('dotenv').config()
var express = require('express');
var fs = require('fs');
var app = express();
var port = process.env.PORT || 8888;
var cors = require('cors');
console.log(port)
// Use middlewares to set view engine and post json data to the server
app.use(express.static('public'));
app.use(cors({
origin: '*'
}));
app.use(express.urlencoded({extended: true}));
app.use(express.json());
const frontEndPath = __dirname + "/../frontend/dist/fuse";
app.use(express.static(frontEndPath));
const frontEndPath2 = __dirname + "/../frontend_react/build";
app.use(express.static(frontEndPath2));
app.get('/login', (req, res)=>{
const html = fs.readFileSync(frontEndPath2 + '/index.html').toString('utf8')
res.send(html);
});
app.get('/dashboard', (req, res)=>{
const html = fs.readFileSync(frontEndPath + '/index.html').toString('utf8')
res.send(html);
});
app.listen(port, ()=>{
console.log('Server is running on Port: ', port);
});