Serve clientbuild format on a single server program

This commit is contained in:
Felix Albrigtsen 2022-03-29 10:55:49 +02:00
parent f3f5dbd864
commit 08e328b8e4
2 changed files with 7 additions and 6 deletions

1
src/server/clientbuild Symbolic link
View File

@ -0,0 +1 @@
../../../sysut_client/src/client/build

View File

@ -7,7 +7,7 @@ let tmdb = require("./tmdb.js");
// #region Express setup // #region Express setup
const app = express(); const app = express();
const port = 5000; const port = 3000;
app.listen(port, () => { app.listen(port, () => {
console.log(`Listening on port ${port}`) console.log(`Listening on port ${port}`)
}) })
@ -32,14 +32,14 @@ api.use(require('express-log-url'));
// res.redirect("https://asura.feal.no/"); // res.redirect("https://asura.feal.no/");
// }); // });
// Serve static files from the React app // Serve static files from the React app
// app.use('/', express.static(path.join(__dirname, 'clientbuild'))); app.use('/', express.static(path.join(__dirname, 'clientbuild')));
// app.use('/tournament/', express.static(path.join(__dirname, 'clientbuild', 'index.html'))); // app.use('/tournament/', express.static(path.join(__dirname, 'clientbuild', 'index.html')));
// app.use('/tournament/*', express.static(path.join(__dirname, 'clientbuild', 'index.html'))); app.use('/tournament/*', express.static(path.join(__dirname, 'clientbuild', 'index.html')));
app.use('/static', express.static(path.join(__dirname, 'clientbuild/static'))); app.use('/static', express.static(path.join(__dirname, 'clientbuild/static')));
app.use('/static/*', express.static(path.join(__dirname, 'clientbuild/static'))); app.use('/static/*', express.static(path.join(__dirname, 'clientbuild/static')));
app.get('/*', function (req, res) { // app.get('/*', function (req, res) {
res.sendFile(path.join(__dirname, 'clientbuild', 'index.html')); // res.sendFile(path.join(__dirname, 'clientbuild', 'index.html'));
}); // });
// app.use('/*', express.static(path.join(__dirname, 'clientbuild'))); // app.use('/*', express.static(path.join(__dirname, 'clientbuild')));
// #endregion // #endregion