Skip to content

Commit

Permalink
Merge pull request #1467 from bluewave-labs/hotfix/be/move-middleware
Browse files Browse the repository at this point in the history
hotfix: move middleware to after JobQueue initialization
  • Loading branch information
ajhollid authored Dec 23, 2024
2 parents 6a46939 + fdb77bb commit b2e2d08
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit b2e2d08

Please sign in to comment.