You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let app = express(),
User = require("../models/user-model"),
agenda = require("../worker.js");
...
Why require agenda.js in worker.js, then require worker.js in user-controller.js; as opposed to requiring agenda.js directly in user-controller.js? Is there some significance to this pattern for using Agenda? I'm especially confused since worker.js exports nothing. How does this work?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello friends, I'm looking at the example project in the docs and am confused by this CommonJS module require pattern:
lib/agenda.js
worker.js
lib/controllers/user-controller.js
Why require
agenda.js
inworker.js
, then requireworker.js
inuser-controller.js
; as opposed to requiringagenda.js
directly inuser-controller.js
? Is there some significance to this pattern for using Agenda? I'm especially confused sinceworker.js
exports nothing. How does this work?Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions