Skip to content
Newer
Older
100644 58 lines (43 sloc) 1.79 KB
585154a @tj Initial commit
authored
1
2 # connect-useragent
3
8e3d9e9 @tj docs
authored
4 A tiny Connect user-agent middleware exposing user-agent details to your application and views. A good idea by @guille backed by @3rd-Eden's [useragent](https://github.com/3rd-Eden/useragent) module.
585154a @tj Initial commit
authored
5
09cc319 @tj done
authored
6 ## Installation
7
8 $ npm install connect-useragent
9
10 ## Example
11
12 ```js
13 var connect = require('connect')
14 , useragent = require('connect-useragent');
15
16 connect()
17 .use(connect.logger('dev'))
18 .use(useragent())
19 .use(function(req, res){
20 console.log(req.agent);
21 })
22 .listen(3000);
23 ```
24
25 provides details such as the following:
26
27 ```js
e3e4178 @tj Added machine variants of family and os
authored
28 { family: { name: 'Safari', machine: 'safari' },
29 major: '5',
09cc319 @tj done
authored
30 minor: '0',
e3e4178 @tj Added machine variants of family and os
authored
31 patch: '4',
32 os: { name: 'Mac OS X', machine: 'mac-os-x' } }
09cc319 @tj done
authored
33 ```
34
585154a @tj Initial commit
authored
35 ## License
36
37 (The MIT License)
38
39 Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
40
41 Permission is hereby granted, free of charge, to any person obtaining
42 a copy of this software and associated documentation files (the
43 'Software'), to deal in the Software without restriction, including
44 without limitation the rights to use, copy, modify, merge, publish,
45 distribute, sublicense, and/or sell copies of the Software, and to
46 permit persons to whom the Software is furnished to do so, subject to
47 the following conditions:
48
49 The above copyright notice and this permission notice shall be
50 included in all copies or substantial portions of the Software.
51
52 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
53 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
54 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
55 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
56 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
57 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
58 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Something went wrong with that request. Please try again.