Created
August 3, 2018 16:22
-
-
Save cristiangrojas/0bb91f191b1f5522227b2865b225c396 to your computer and use it in GitHub Desktop.
Simple server in Express.js for create-react-app build copy
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 bodyParser = require('body-parser') | |
const path = require('path'); | |
const app = express(); | |
app.use(express.static(path.join(__dirname, 'build'))); | |
app.get('/*', function (req, res) { | |
res.sendFile(path.join(__dirname, 'build-copy', 'index.html')); | |
}); | |
app.listen(process.env.PORT || 8080); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment