Skip to content

Instantly share code, notes, and snippets.

@L1fescape
Created September 4, 2017 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save L1fescape/5474e8bd46c4ab58fb273717437d2a85 to your computer and use it in GitHub Desktop.
Save L1fescape/5474e8bd46c4ab58fb273717437d2a85 to your computer and use it in GitHub Desktop.
`yarn add --dev express`
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