3 var env = require('gitter-web-env');
4 var winston = env.logger;
5 var pushNotificationService = require('gitter-web-push-notifications');
7 module.exports = function(req, res, next) {
8 var deviceId = req.body.deviceId;
9 var deviceName = req.body.deviceName;
10 var deviceType = req.body.deviceType;
11 var deviceToken = new Buffer(req.body.deviceToken, 'base64');
12 var appVersion = req.body.version || null;
13 var appBuild = req.body.build || null;
15 winston.info('APN device registration', {
17 deviceName: deviceName,
18 deviceType: deviceType
21 return pushNotificationService
22 .registerDevice(deviceId, deviceType, deviceToken, deviceName, appVersion, appBuild)
24 res.send({ success: true });