We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0c8680f commit df8f529Copy full SHA for df8f529
server/index.js
@@ -24,5 +24,18 @@ app.use(passport.session());
24
require('./routes/authRoutes')(app);
25
require('./routes/billingRoutes')(app);
26
27
+if (process.env.NODE_ENV === 'production') {
28
+ // Express will serve up production assets
29
+ // like our main.js file, or main.css file!
30
+ app.use(express.static('client/build'));
31
+
32
+ // Express will serve up the index.html file
33
+ // if it doesn't recognize the route
34
+ const path = require('path');
35
+ app.get('*', (req, res) => {
36
+ res.sendFile(path.resolve(__dirname, 'client', 'build', 'index.html'));
37
+ });
38
+}
39
40
const PORT = process.env.PORT || 5000;
41
app.listen(PORT);
0 commit comments