Created
November 6, 2020 06:39
Star
You must be signed in to star a gist
keep this file in project root dir
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 path = require('path'); | |
const compression = require('compression'); | |
const port = process.env.PORT || 9000; | |
const app = express(); | |
app.use(compression()); | |
app.use(express.static(path.join(__dirname, '/dist'))); | |
app.get('/*', (req, res) => { | |
res.sendFile(path.join(__dirname, '/dist', 'index.html')); | |
}); | |
app.listen(port, (err) => { | |
if (!err) { | |
console.log('Listening on port', port); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment