Merge pull request #1467 from bluewave-labs/hotfix/be/move-middleware

hotfix: move middleware to after JobQueue initialization
This commit is contained in:
Alexander Holliday
2024-12-23 15:17:41 -08:00
committed by GitHub

View File

@@ -70,15 +70,6 @@ const startApp = async () => {
app.use(express.json());
app.use(helmet());
// Add db, jobQueue, emailService, and settingsService to request object for easy access
app.use((req, res, next) => {
req.db = db;
req.jobQueue = jobQueue;
req.emailService = emailService;
req.settingsService = settingsService;
next();
});
// Swagger UI
app.use("/api-docs", swaggerUi.serve, swaggerUi.setup(openApiSpec));
@@ -162,6 +153,15 @@ const startApp = async () => {
Worker
);
// Add db, jobQueue, emailService, and settingsService to request object for easy access
app.use((req, res, next) => {
req.db = db;
req.jobQueue = jobQueue;
req.emailService = emailService;
req.settingsService = settingsService;
next();
});
const shutdown = async () => {
if (isShuttingDown) {
return;