express-browser-detect/index.js

16 lines
329 B
JavaScript
Raw Normal View History

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