Connect middleware for device detection based on Categorizr
npm install connect-categorizrConnect middleware that provides device detection, based on Brett Jankord's Categorizr.
``bash`
npm install connect-categorizr
* useSession: Store the device type in the session for quicker lookups on subsequent requests. Defaults to true.
`js
var connect = require('connect'),
categorizr = require('connect-categorizr');
var app = connect();
app.use(categorizr());
`
The middleware will add the following immutable properties to the req object:
* deviceType: String containing the matched device type (mobile, tablet, desktop or tv)isMobile
* : true if the device is a phoneisTablet
* : true if the device is a tabletisDesktop
* : true if the device is a desktop browserisTV
* : true if the device is a TV
First, install the test dependencies
`bash`
npm install -d
and then run the tests
`bash``
make test