Skip to content

Commit fb49bdb

Browse files
committed
added production static file path
1 parent 8fcefeb commit fb49bdb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

server/server.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,17 @@ app.delete(
188188
(req, res) => res.status(200).json(res.locals.deleted)
189189
);
190190

191+
192+
//if in production mode, statically serve everything in the build folder on the route '/dist'
193+
if (process.env.NODE_ENV == 'production'){
194+
app.use('/dist', express.static(path.join(__dirname, '../dist')));
195+
196+
// serve index.html on the route '/'
197+
app.get('/', (req, res) => {
198+
return res.status(200).sendFile(path.join(__dirname, '../index.html'));
199+
});
200+
}
201+
191202
app.get('/', function(req, res) {
192203
res.send('Houston, Caret is in orbit!');
193204
});

0 commit comments

Comments
 (0)