Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 322323a

Browse files
committed
serve
1 parent 298398c commit 322323a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

server/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ app.use(cors({
4040
credentials: true
4141
}));
4242
app.use(express.json());
43+
app.use(express.static(path.join(__dirname, "../client/build")));
4344
app.use('/api/shipments', shipmentsRoutes);
4445
// MongoDB Connection
4546
const mongoURI = process.env.mongoURIProduction;
@@ -627,6 +628,9 @@ app.get('/history', async (req, res) => {
627628
res.status(500).json({ status: 'error', message: 'An error occurred while fetching shipment data.' });
628629
}
629630
});
631+
app.get("*", (req, res) => {
632+
res.sendFile(path.join(__dirname, "../client/build/index.html"));
633+
});
630634
// Start Server
631635
server.listen(PORT, () => {
632636
console.log(` Server running on PORT: ${PORT}`);

0 commit comments

Comments
 (0)