Created
August 3, 2020 14:36
-
-
Save RoryCombe/f8e5e5b6f11e7fc1a60e3a981b863688 to your computer and use it in GitHub Desktop.
This file contains 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 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