Skip to content

Commit c77d629

Browse files
committed
Only add redirect route for prod or dev
1 parent 3954614 commit c77d629

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

backend/src/app.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ app.use('/api/auth', authRouter);
4343
app.use('/api/likes', likeRouter);
4444
app.use('/api/notifications', notificationRouter);
4545

46-
app.get('*', (_req, res) => {
47-
const prodPath = path.join(__dirname, 'index.html');
48-
const devPath = path.join(__dirname, '..', 'build', 'index.html');
46+
if (NODE_ENV === ('production' || 'development')) {
47+
app.get('*', (_req, res) => {
48+
const prodPath = path.join(__dirname, 'index.html');
49+
const devPath = path.join(__dirname, '..', 'build', 'index.html');
4950

50-
res.sendFile(NODE_ENV === 'production' ? prodPath : devPath);
51-
});
51+
res.sendFile(NODE_ENV === 'production' ? prodPath : devPath);
52+
});
53+
}
5254

5355
if (NODE_ENV !== 'production') {
5456
app.use('/api/test', testRouter);

0 commit comments

Comments
 (0)