INNER CODE UNIT · JavaScript
apex
immers-space/activitypub-express · index.js:8
const apex = function (req, res, next) {
req.app.locals.apex = apex // apex api object
res.locals.apex = {
eventName: null,
eventMessage: {},
postWork: []
}
onFinished(res, onFinishedHandler)
next()
}
// bind pub methods at top level so their 'this' is apex instance
for (const prop in pub) {
if (typeof pub[prop] === 'function') {
apex[prop] = pub[prop].bind(apex)
} else {
apex[prop] = pub[prop]
}
}