Skip to content

Commit

Permalink
production static files
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanchristie committed Sep 10, 2018
1 parent ffd7eae commit abca2f2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ require('./routes/twitterRoutes')(app);
require('./routes/quotesRoutes')(app);
const path = require('path');

// Send index.html for anything else

app.get('*', (req, res) => {
res.sendFile(path.resolve(__dirname, 'client', 'build', 'index.html'));
})
if (process.env.NODE_ENV === 'production') {
app.use(express.static(__dirname + '/app/build'));

app.get('*', (req, res) => {
res.sendFile(__dirname + '/app/build/index.html');
});
}

app.listen(PORT, () => console.log(`Listening on port ${PORT}`));

0 comments on commit abca2f2

Please sign in to comment.