本文整理汇总了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
});
},