0.1.0 • Published 10 years ago

cocotte-device v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

cocotte-device

はじめに

express用のexpress-deviceKoa用のミドルウェアに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);