Skip to content

Commit be86ef9

Browse files
committed
Config and edits
1 parent f50c891 commit be86ef9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

backend/question-service/src/middlewares/basicAccessControl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ export const verifyAdminToken = (
1212
.then(() => next())
1313
.catch((err) => {
1414
console.log(err.response);
15-
return res.status(err.response.status).json(err.response.data);
15+
return res.status(err.response?.status).json(err.response?.data);
1616
});
1717
};

backend/question-service/src/server.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
import app from "./app.ts";
22
import connectDB from "./config/db.ts";
3+
import { seedQuestions } from "./scripts/seed.ts";
34

45
const PORT = process.env.SERVICE_PORT || 3000;
56

67
if (process.env.NODE_ENV !== "test") {
78
connectDB()
89
.then(() => {
910
console.log("MongoDB Connected!");
11+
// seedQuestions();
1012

11-
app.listen(PORT, () => {
13+
const server = app.listen(PORT, () => {
1214
console.log(
1315
`Question service server listening on http://localhost:${PORT}`,
1416
);
1517
});
18+
19+
server.keepAliveTimeout = 70 * 1000; // set timeout value to > load balancer idle timeout (60s)
1620
})
1721
.catch((err) => {
1822
console.error("Failed to connect to DB");

0 commit comments

Comments
 (0)