lamassu-server/lib/middlewares/operatorId.js
2021-11-22 11:31:56 +00:00

15 lines
367 B
JavaScript

const { getOperatorId } = require('../operator')
function findOperatorId (req, res, next) {
return getOperatorId('middleware')
.then(({ operatorId }) => {
res.locals.operatorId = operatorId
return next()
})
.catch(e => {
console.error('Error while computing operator id\n' + e)
next(e)
})
}
module.exports = findOperatorId