diff --git a/.github/workflows/main_carubbi-snake.yml b/.github/workflows/main_carubbi-snake.yml new file mode 100644 index 0000000..f1186bc --- /dev/null +++ b/.github/workflows/main_carubbi-snake.yml @@ -0,0 +1,56 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions + +name: Build and deploy Node.js app to Azure Web App - carubbi-snake + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Node.js version + uses: actions/setup-node@v1 + with: + node-version: '16.x' + + - name: npm install, build, and test + run: | + npm install + + + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v2 + with: + name: node-app + path: . + + deploy: + runs-on: ubuntu-latest + needs: build + environment: + name: 'Production' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v2 + with: + name: node-app + + - name: 'Deploy to Azure Web App' + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: 'carubbi-snake' + slot-name: 'Production' + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_891E36B2E7C64F769A7C76009AA41D42 }} + package: . diff --git a/README.md b/README.md index 6e51d47..a0189a5 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,9 @@ (original version from a youtube video linked below) https://youtu.be/J42SZXS-_Qo -[![Build Status](https://travis-ci.org/joemccann/dillinger.svg?branch=master)](https://travis-ci.org/joemccann/dillinger) - Fatures: - -Live demo here: -https://carubbi-snake.herokuapp.com/frontend/snake.html - +Live demo here: https://carubbi-snake.azurewebsites.net ## Features diff --git a/multiplayer/backend/server.mjs b/multiplayer/backend/server.mjs index c049bbc..92f93e3 100644 --- a/multiplayer/backend/server.mjs +++ b/multiplayer/backend/server.mjs @@ -13,11 +13,14 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url)); // select port according to environment const port = process.env.PORT || 3000; - +const options = { + index: "snake.html" +}; // listen to port 3000 httpServer.listen(port, function () { // serve frontend game - app.use("/frontend", express.static(path.join(__dirname, '..', 'frontend'))); + + app.use("/", express.static(path.join(__dirname, '..', 'frontend'), options)); app.use("/scripts", express.static(path.join(__dirname, '..', 'scripts')));