Skip to content

Instantly share code, notes, and snippets.

@fabidick22
Last active April 21, 2020 19:11
Show Gist options
  • Save fabidick22/af5a1cf8493ae0958f396522f74dc139 to your computer and use it in GitHub Desktop.
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)
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);
# 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