base commit

This commit is contained in:
b1ek 2023-03-18 21:32:08 +10:00
commit 4e0f0f3f7e
Signed by: blek
GPG Key ID: 14546221E3595D0C
3 changed files with 31 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
node_modules
package-lock.json
yarn.lock

16
index.js Normal file
View File

@ -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;

12
package.json Normal file
View File

@ -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"
}
}