node.jsexpressuser-agent

How to handle user-agent in nodejs environment?


I start to using the package "ua-parser" but the creator is too busy to mantain or commit... the npm ua-parser is outdate, and need to download directly from github. Someone know about other good package like ua-parser that is updated and can be used with expressjs? Or have a way to handle just with expressjs?


Solution

  • Have you looked at:

    Or, write your own middleware:

    app.use(function(req, res, next) {
      res.locals.ua = req.get('User-Agent');
      next();
    });
    

    Reference: get user agent from inside jade