cocotte-device

0.1.0 • Public • Published

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);

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i cocotte-device

      Weekly Downloads

      0

      Version

      0.1.0

      License

      MIT

      Last publish

      Collaborators

      • yukik