From f3f5dbd864c53bb78f292a999dd24bde2123c7df Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Tue, 29 Mar 2022 10:45:50 +0200 Subject: [PATCH] Revert hosting --- src/server/index.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/server/index.js b/src/server/index.js index b1136cf..9ed1cf0 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -15,7 +15,7 @@ app.use(express.json()); app.use(express.urlencoded({ extended: true })); let api = express.Router(); // app.use("/api", api); -app.use("/", api); +app.use("/api", api); api.use(function(req, res, next) { res.header("Access-Control-Allow-Origin", "*"); @@ -28,17 +28,18 @@ api.use(require('express-log-url')); // #region frontend -api.get("/", (req, res) => { - res.redirect("https://asura.feal.no/"); -}); +// api.get("/", (req, res) => { +// res.redirect("https://asura.feal.no/"); +// }); // Serve static files from the React app // 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('/static', express.static(path.join(__dirname, 'clientbuild/static'))); -// app.get('/*', function (req, res) { -// res.sendFile(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.get('/*', function (req, res) { + res.sendFile(path.join(__dirname, 'clientbuild', 'index.html')); +}); // app.use('/*', express.static(path.join(__dirname, 'clientbuild'))); // #endregion