We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 96edf6a commit ddcaceeCopy full SHA for ddcacee
src/service/index.js
@@ -64,10 +64,16 @@ const createApp = async () => {
64
app.use(express.json());
65
app.use(express.urlencoded({ extended: true }));
66
app.use('/', routes);
67
- app.use('/', express.static(absBuildPath));
68
- app.get('/*', (req, res) => {
69
- res.sendFile(path.join(`${absBuildPath}/index.html`));
70
- });
+
+ // In production, serves the static files from the build directory
+ if (process.env.NODE_ENV === 'production') {
+ app.use('/', express.static(absBuildPath));
71
+ app.get('/*', (req, res) => {
72
+ res.sendFile(path.join(`${absBuildPath}/index.html`));
73
+ });
74
+ } else {
75
+ console.log('Not serving static files');
76
+ }
77
78
return app;
79
};
0 commit comments