Skip to content

Commit b2b2141

Browse files
committed
backend: fix the infinite loop bug when trying to access the endpoints
1 parent 8544326 commit b2b2141

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/app.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import express, { Application } from "express";
1+
import express, { Application, Response, NextFunction } from "express";
22
import path from "path";
33
import cors from "cors";
44
import { getCard } from "./controllers/cards-controller";
@@ -7,15 +7,16 @@ const app: Application = express();
77

88
const PORT = process.env.PORT || 8080;
99

10+
app.get("/api/cards", getCard);
11+
app.get("/api/themes", cors(), getThemes);
12+
1013
app.use(
1114
"/",
1215
express.static(path.join(__dirname, "..", "client", "build")),
13-
(_, res) => {
16+
(_, res: Response, next: NextFunction) => {
1417
res.setHeader("Cache-Control", "no-store, no-cache");
18+
next();
1519
}
1620
);
1721

18-
app.get("/api/cards", getCard);
19-
app.get("/api/themes", cors(), getThemes);
20-
2122
app.listen(PORT, () => console.log("The server is running!"));

0 commit comments

Comments
 (0)