0.0.5 • Published 9 years ago

koa-weixin-token v0.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

Koa weixin-token

weixin-token for koa.

Install

npm install koa-weixin-token

API

const Koa = require('koa');
const app = new Koa();

app.use(require('koa-weixin-token')({
  appid: 'YOUR_WEIXIN_APPID',
  secret: 'YOUR_WEIXIN_SECRET'
}));

app.use(funciton* (){
  this.body = {
    token: this.weixinToken,
    jsapiTicket: this.weixinJsApiTicket
  };
});

this.weixinToken/weixinJsApiTicket

app.use(funciton* (){
  this.body = {
    token: this.weixinToken,
    jsapiTicket: this.weixinJsApiTicket
  };
});

without koa

const Weixin = require('koa-weixin-token/weixin');

var weixin = new Weixin({
  appid: 'YOUR_WEIXIN_APPID',
  secret: 'YOUR_WEIXIN_SECRET'
});

weixin.on('token', function(token, expire){
  console.log('token', token, expire, this.getToken());
}).on('ticket', function(token, expire){
  console.log('ticket', token, expire, this.getTicket());
});
0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago