0.1.0 • Published 10 years ago

connect-ua-parser v0.1.0

Weekly downloads
2
License
-
Repository
github
Last release
10 years ago

connect-ua-parser

Integrates ua-parser with connect/express

Installation

npm install connect-ua-parser

Usage

Initialize the middleware with :

var connect = require('connect'),
    connectUaParser = require('connect-ua-parser'),
    app = connect();

app.use(connectUaParser());

By default, the middleware will parse the user-agent header using the ua-parser library and attach it to the request object at req.useragent.

Options

requestKey

Specifies the key on the request object the parsed user-agent info will be attached. Defaults to useragent.

ua

Specifies whether to use the ua parser from the ua-parser library. Defaults to true.

os

Specifies whether to use the os parser from the ua-parser library. Defaults to true.

device

Specifies whether to use the device parser from the ua-parser library. Defaults to true.