Created
October 28, 2019 04:45
-
-
Save JosepRoo/a502f207fb20f9f31275635ddbec6678 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
//Install express server | |
const express = require('express'); | |
const path = require('path'); | |
const bodyParser = require('body-parser'); | |
const app = express(); | |
app.use(bodyParser.urlencoded({ extended: false })); | |
app.use(bodyParser.json()); | |
// Serve only the static files form the dist directory | |
app.use(express.static(__dirname + '/dist')); | |
app.get('/*', function(req,res) { | |
res.sendFile(path.join(__dirname+'/dist/index.html')); | |
}); | |
// Start the app by listening on the default Heroku port | |
app.listen(process.env.PORT || 8080); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment