Changed hosting path

This commit is contained in:
Felix Albrigtsen 2022-03-28 22:28:34 +02:00
parent d97e943ff1
commit 5c494d7018
1 changed files with 15 additions and 4 deletions

View File

@ -7,14 +7,15 @@ let tmdb = require("./tmdb.js");
// #region Express setup // #region Express setup
const app = express(); const app = express();
const port = 3000; const port = 5000;
app.listen(port, () => { app.listen(port, () => {
console.log(`Listening on port ${port}`) console.log(`Listening on port ${port}`)
}) })
app.use(express.json()); app.use(express.json());
app.use(express.urlencoded({ extended: true })); app.use(express.urlencoded({ extended: true }));
let api = express.Router(); let api = express.Router();
app.use("/api", api); // app.use("/api", api);
app.use("/", api);
api.use(function(req, res, next) { api.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Origin", "*");
@ -26,9 +27,19 @@ api.use(require('express-log-url'));
// #endregion // #endregion
// #region frontend // #region frontend
api.get("/", (req, res) => {
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'))); // 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('/*', express.static(path.join(__dirname, 'clientbuild')));
// #endregion // #endregion