express-browser-detect/index.js

15 lines
290 B
JavaScript
Raw Normal View History

2023-03-18 12:32:08 +01:00
const Browser = require('which-browser');
/**
*
2023-03-18 14:10:24 +01:00
* @param {Express.Request} req
* @param {Express.Response} res
2023-03-18 12:32:08 +01:00
* @param {*} next
*/
function handler(req, res, next) {
const browser = new Browser(req.headers);
req.browser = browser;
next();
}
module.exports = handler;