From 03a4d103ebb4c816fc8afb5b6e7b466d852a1077 Mon Sep 17 00:00:00 2001 From: Oliver Boehlk Date: Sat, 18 Apr 2020 01:01:06 +0200 Subject: [PATCH 1/5] host compiled files --- backend/index.js | 6 ++++++ 1 file changed, 6 insertions(+) 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) { -- 2.49.1 From 7799df9ba4b4fb244f5d7c52d8113a7710092c63 Mon Sep 17 00:00:00 2001 From: Oliver Boehlk Date: Sat, 18 Apr 2020 01:01:18 +0200 Subject: [PATCH 2/5] create frontend folder for build --- update.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/update.sh b/update.sh index e76d977..a6ff8fc 100755 --- a/update.sh +++ b/update.sh @@ -3,6 +3,7 @@ kill -9 $BACKENDID git checkout master && git pull && cd backend +mkdir frontend npm i cd ../frontend npm i -- 2.49.1 From 475456e6187a019efca21301c8725098eb4a30fd Mon Sep 17 00:00:00 2001 From: Oliver Boehlk Date: Sat, 18 Apr 2020 01:02:30 +0200 Subject: [PATCH 3/5] don't enforce master branch --- update.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/update.sh b/update.sh index a6ff8fc..5eaf643 100755 --- a/update.sh +++ b/update.sh @@ -1,7 +1,6 @@ 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 mkdir frontend npm i -- 2.49.1 From e26d5f59a94ec5c69204e336813d0bfff9b3efa7 Mon Sep 17 00:00:00 2001 From: Oliver Boehlk Date: Sat, 18 Apr 2020 01:06:08 +0200 Subject: [PATCH 4/5] finish autoupdate --- backend/.gitignore | 2 +- update.sh | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) 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/update.sh b/update.sh index 5eaf643..bfe83c1 100755 --- a/update.sh +++ b/update.sh @@ -7,7 +7,6 @@ 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 -- 2.49.1 From a1770c2f41399a8dc7d4c134192060a7c4e859d9 Mon Sep 17 00:00:00 2001 From: Oliver Boehlk Date: Sat, 18 Apr 2020 01:14:47 +0200 Subject: [PATCH 5/5] remove frontendfolder before rebuild --- update.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/update.sh b/update.sh index bfe83c1..01ac4d7 100755 --- a/update.sh +++ b/update.sh @@ -2,6 +2,7 @@ BACKENDID = netstat -tulpn 2>/dev/null | grep ":3001 " | awk '{print $7;}' | cut kill -9 $BACKENDID git pull cd backend +rm -r ./frontend mkdir frontend npm i cd ../frontend -- 2.49.1