本文整理匯總了TypeScript中newrelic.setControllerName函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript setControllerName函數的具體用法?TypeScript setControllerName怎麽用?TypeScript setControllerName使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了setControllerName函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
deactivateCoupon: function (req, res) {
NewRelic.setControllerName('ProfileController.deactivateCoupon');
var addonId = req.param('id');
var code:String = req.param('code');
Addon.findOne(addonId)
.then(function (addon:Addon) {
if (addon === undefined) {
res.notFound();
} else if (!addon.canModify(req.user)) {
res.forbidden();
} else if (!addon.couponExists(code)) {
req.flash('error', "That coupon does not exist.");
res.redirect('/profile/addons/' + addonId);
} else if (!addon.isValidCoupon(code)) {
req.flash('error', "That coupon has already expired.");
res.redirect('/profile/addons/' + addonId);
} else {
return addon.deactivateCoupon(code);
}
})
.then(function () {
req.flash('success', "Coupon '" + code + "' has been deactivated.");
res.redirect('/profile/addons/' + addonId)
});
},
示例2: function
validateCoupon: function (req, res) {
NewRelic.setControllerName('AddonsController.validateCoupon');
if (!req.isSocket) {
req.flash('error', 'Only sockets may validate coupons');
res.redirect('/')
}
var addonId = req.param('id');
var couponCode = req.param('couponCode');
// We don't need to do a full populate because coupons are stored directly on the addon
Addon.findOne(addonId)
.then(function (addon:Addon) {
if (addon === undefined) {
req.socket.emit('notification', {
type: 'error',
msg: 'That addon does not exist'
});
} else {
req.socket.emit('couponValidated', addon.getCoupon(couponCode));
}
}).catch(function (err) {
PrettyError(err, "Something went wrong during Addon.findOne inside AddonsController.validateCoupon:")
});
},
示例3: function
termsOfService: function (req, res) {
NewRelic.setControllerName('StaticController.termsOfService');
res.view({
title: 'Terms of Service',
activeTab: 'extra',
breadcrumbs: true
});
},