express-isdevice

1.0.4 • Public • Published

#Express is Device

This module detects what kind of device is accessing the server. The algorithm of this module replicates part of the 'express-device' module therefore ensured for all merit to .

##Install

Just type the folowing command or put express-isdevice in your package.json

$ npm install express-isdevice

##Ways to use

Currently you can use the proxy function as a middleware in their requests. When the middleware proxy is called, will add a variable in device object req.

Sample:

var device = require("express-isdevice");

app.get("/", [device.proxy], function(){});

// you can use multiples middlewares
app.get("/", [device.proxy, myFn], function(){});

##Get device info

To get the device just call req.device.is. <device>, this returns true or false. The supported devices are:

  • bot - for scripts and programs
  • Desktop - PC, etc.
  • empty - if not a 'user-agent' defined in the request
  • phone - smartphones in general
  • tablet - iPad, etc.
  • tv - GoogleTV, etc.
  • unknown - the 'user-agent' is unknown

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i express-isdevice

      Weekly Downloads

      6

      Version

      1.0.4

      License

      GPL-v2

      Last publish

      Collaborators

      • luis.kaufmann.silva