New webpack config, scripts & moved dist, favicons & assets to /public

This commit is contained in:
2022-03-05 13:10:21 +01:00
parent 25dd8bea9e
commit caa8dffc87
24 changed files with 141 additions and 76 deletions

View File

@@ -1,23 +1,18 @@
var express = require('express');
var path = require('path');
const compression = require('compression')
var history = require('connect-history-api-fallback');
const express = require("express");
const path = require("path");
const history = require("connect-history-api-fallback");
const publicPath = path.join(__dirname, "public");
app = express();
app.use("/", express.static(publicPath));
app.use(history({ index: "/" }));
app.use(compression())
app.use('/dist', express.static(path.join(__dirname + "/dist")));
app.use('/dist', express.static(path.join(__dirname + "/dist/")));
app.use('/favicons', express.static(path.join(__dirname + "/favicons")));
app.use(history({
index: '/'
}));
var port = process.env.PORT || 5000;
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname + '/index.html'));
app.get("/", function (req, res) {
res.sendFile(`${publicPath}/index.html`);
});
const port = process.env.PORT || 5001;
console.log("Server runnning at port:", port);
app.listen(port);