Last active
April 21, 2020 19:11
-
-
Save fabidick22/af5a1cf8493ae0958f396522f74dc139 to your computer and use it in GitHub Desktop.
Express server file to integrate a static application with the Azure App-Services service. (Error: Cannot GET /path)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const server = express(); | |
const options = { | |
index: ['index.html','hostingstart.html'] | |
}; | |
server.use('/', express.static(__dirname, options)); | |
server.get('/*', (req, res) => { | |
res.sendFile(__dirname + "/" + options.index[1]); | |
}); | |
server.listen(process.env.PORT); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Azure > App-Services > Configuration > General Settings > Startuo Command | |
pwd && cp -rf * /opt/startup/ && ls /opt/startup/ && pm2 start --no-daemon /opt/startup/server.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment