base commit
This commit is contained in:
commit
4e0f0f3f7e
|
@ -0,0 +1,3 @@
|
|||
node_modules
|
||||
package-lock.json
|
||||
yarn.lock
|
|
@ -0,0 +1,16 @@
|
|||
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;
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"name": "express-browser",
|
||||
"version": "1.0.0",
|
||||
"description": "Detect client's browser in Express.JS",
|
||||
"main": "index.js",
|
||||
"author": "b1ek",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"express": "^4.18.2",
|
||||
"which-browser": "^0.7.0"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue