Вы можете использовать npm install node-device-detector --production
const DeviceDetector = require('node-device-detector');
const detector = new DeviceDetector;
var userAgent ='' // req.headers['user-agent']
console.log(detector.detect(userAgent));
console.log('isDesktop', detector.isDesktop());
console.log('isTabled', detector.isTabled());
console.log('isPhablet', detector.isPhablet());
console.log('isIOS', detector.isIOS());
console.log('isAndroid', detector.isAndroid());
console.log('isMobile', detector.isMobile());
Замените userAgent вашим заголовком: req.headers ['user-agent'].