cocotte-device
0.1.0 • Public • Published cocotte-device
はじめに
express用のexpress-deviceを
Koa用のミドルウェアにforkしたものです。
デバイス名を判別しsessionに保存します。
使用方法
ミドルウェアに設定することで、this.session.device
を参照する事で
ユーザーエージェントからクライアントのデバイスタイプを取得します
var koa = require('koa')
, app = koa()
, session = require('koa-sess')
, device = require('cocotte-device');
app.use(session());
app.use(device);
app.use(function*(next){
console.log(this.session.device);
yield next;
});
app.listen(3000);
Package Sidebar
Install
Weekly Downloads