Skip to content

Commit 6a3bbc0

Browse files
authored
Simplify static file serving in production
1 parent 5b2a0b3 commit 6a3bbc0

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

backend/index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ app.use(
1616
credentials: true,
1717
}),
1818
);
19-
if (process.env.NODE_ENV === "production") {
20-
app.use(express.static(path.join(__dirname, "./build")));
21-
}
19+
app.use(express.static(path.join(__dirname, "./build")));
2220

2321
app.use(bodyParser.json({ limit: "50mb" })); //limit limits the data which can be uploaded to server.js from frontend
2422
const store = new MongoDBStore({
@@ -45,9 +43,7 @@ app.use(
4543
);
4644

4745
app.get("/", cors(), (req, res) => {
48-
if (process.env.NODE_ENV === "production") {
49-
res.sendFile(path.join(__dirname, "./build", "index.html"));
50-
}
46+
res.sendFile(path.join(__dirname, "./build", "index.html"));
5147
});
5248

5349
app.use("/en", approute); //routing to all functions

0 commit comments

Comments
 (0)