Created
January 4, 2020 21:39
-
-
Save mattmazzola/6c8dec90e302914361ef815f88f47917 to your computer and use it in GitHub Desktop.
How to host React build from 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
const express = require('express'); | |
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', 'index.html')); | |
}); | |
app.listen(9000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment