Created
May 21, 2018 19:59
-
-
Save oscaroceguera/d168c65580967125f7ab56b6ccb92ac5 to your computer and use it in GitHub Desktop.
Load static app with react, react-router-4, 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() | |
const port = process.env.PORT || 8000 | |
app.use(express.static(path.join(__dirname, '/public'))) | |
app.get('*', function (req, res) { | |
res.sendFile(path.resolve(__dirname, 'public', 'index.html')) | |
}) | |
app.listen(port, () => { | |
console.log('http://localhost:', port) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment