Connect middleware for device detection based on Categorizr

npm install connect-categorizr
4 downloads in the last week
11 downloads in the last month


Connect middleware that provides device detection, based on Brett Jankord's Categorizr.


npm install connect-categorizr


  • useSession: Store the device type in the session for quicker lookups on subsequent requests. Defaults to true.


var connect = require('connect'),
    categorizr = require('connect-categorizr');

var app = connect();

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 phone
  • isTablet: true if the device is a tablet
  • isDesktop: true if the device is a desktop browser
  • isTV: true if the device is a TV


First, install the test dependencies

npm install -d

and then run the tests

make test


To build connect-categorizr from the lastest Categorizr source and tests, first install the dependencies

npm install -d

and then build the project


The tests are large and take a while to download, so the build may take a few minutes.

npm loves you