-
-
Save velopert/3e4094b4208a6124a310181fa9f72017 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
const express = require('express'); | |
const app = express(); | |
const path = require('path'); | |
app.use('/', express.static(path.resolve(__dirname, '../build'))); | |
app.get('*', (req, res, next) => { | |
if(req.path.split('/')[1] === 'static') return next(); | |
res.sendFile(path.resolve(__dirname, '../build/index.html')); | |
}); | |
app.listen(4000, function () { | |
console.log('Example app listening on port 4000!'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment