1.0.4 • Published 10 years ago

express-isdevice v1.0.4

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

#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
1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.1

10 years ago