@tlrg/middleware-js
Version:
Node module for sharing common middlewares.
15 lines (13 loc) • 477 B
JavaScript
module.exports = function (req, res, next) {
var cobrands = req.app.get('cobrandsConfig');
if (req.subdomains || req.query.cobrand) {
var subdomain = req.query.cobrand || req.subdomains[req.subdomains.length - 1];
if (cobrands[subdomain]) {
req.moonstick.brand = subdomain;
req.moonstick.pcode = cobrands[subdomain].pcode;
req.moonstick.domain = 'cobrands';
return next();
}
}
next();
};