Skip to content

Instantly share code, notes, and snippets.

@RoryCombe
Created August 3, 2020 14:36
Show Gist options
  • Save RoryCombe/f8e5e5b6f11e7fc1a60e3a981b863688 to your computer and use it in GitHub Desktop.
Save RoryCombe/f8e5e5b6f11e7fc1a60e3a981b863688 to your computer and use it in GitHub Desktop.
const express = require('express');
const cors = require('cors');
const app = express();
const rootDir = __dirname + '/app';
app.use(cors());
app.use(express.static(rootDir));
app.get('*', function(req, res) {
res.header('Cache-Control', 'private, no-cache, no-store, must-revalidate');
res.sendfile(rootDir + '/index.html');
});
app.listen(3000, function() {
console.log('App listening on port 3000');
console.log('App source directory is "' + rootDir + '"');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment