diff --git a/backend/.gitignore b/backend/.gitignore index 2d4f78b..ceedb6a 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -109,4 +109,4 @@ dist # Stores VSCode versions used for testing VSCode extensions .vscode-test - +frontend/ diff --git a/backend/index.js b/backend/index.js index 0fbb3f1..b03386d 100644 --- a/backend/index.js +++ b/backend/index.js @@ -26,6 +26,12 @@ app.all("*", function (req, res, next) { if (!serverStartupComplete) return res.send("Server is starting..."); else return next(); +}); + +app.all("*", function (req, res, next) { + if (!/^\/API\/.*/.test(req.url)) { + return res.sendFile(path.join(__dirname, './frontend/index.html')); + } else return next(); }) app.get('/API/day', function (req, res) { diff --git a/update.sh b/update.sh index e76d977..01ac4d7 100755 --- a/update.sh +++ b/update.sh @@ -1,13 +1,13 @@ BACKENDID = netstat -tulpn 2>/dev/null | grep ":3001 " | awk '{print $7;}' | cut -d "/" -f1 kill -9 $BACKENDID -git checkout master && -git pull && +git pull cd backend +rm -r ./frontend +mkdir frontend npm i cd ../frontend npm i npm run build -mv ./build/* -../backend/frontend +mv ./build/* ../backend/frontend cd ../backend npm start \ No newline at end of file