Created
September 4, 2017 02:00
-
-
Save L1fescape/5474e8bd46c4ab58fb273717437d2a85 to your computer and use it in GitHub Desktop.
`yarn add --dev express`
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
var path = require('path'); | |
var express = require('express'); | |
var app = express(); | |
var PORT = process.env.PORT || 3000; | |
var distRoot = './dist' | |
app.use(express.static(distRoot)); | |
app.get('*', function(req, res) { | |
res.sendFile(path.join(__dirname, distRoot, 'index.html')) | |
}) | |
app.listen(PORT, function () { | |
console.log(`Listening on port ${PORT}!`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment