add readme.md
This commit is contained in:
parent
4e0f0f3f7e
commit
6bb2549cfb
|
@ -0,0 +1,33 @@
|
|||
<h1 align='center'>express-browser</h1>
|
||||
This middleware helps you to easily detect the user's browser.
|
||||
|
||||
It uses [which-browser](https://www.npmjs.com/package/which-browser) under the hood, and all the documentation is there
|
||||
|
||||
# Installation
|
||||
```
|
||||
yarn add --save express-browser
|
||||
```
|
||||
|
||||
Or if you prefer `npm`
|
||||
|
||||
```
|
||||
npm install --save express-browser
|
||||
```
|
||||
|
||||
# Example
|
||||
```
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
const port = 3000;
|
||||
const ex_browser = require('express-browser');
|
||||
|
||||
app.use(ex_browser);
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.send('Your browser is: ' + req.browser.browser.toString());
|
||||
})
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Example app listening on port ${port}`);
|
||||
})
|
||||
```
|
Loading…
Reference in New Issue