wechat-yoo
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

wechat-yoo JavaScript Style Guide

一个基于TypeScript的微信公众平台开发框架.

Installation

npm install wechat-yoo

Usage

Koa

npm install koa koa-bodyparser

index.ts:

import Yoo from 'wechat-yoo'
import koaAdapter from 'wechat-yoo/adapters/koa.js'
import Koa from 'koa'
import bodyParser from 'koa-bodyparser'

const yoo = new Yoo('Token')
yoo.default(async (reply, data) => {
  reply.text('Welcome to use WeChatYoo!')
  console.log(data)
})

const app = new Koa()

app.use(bodyParser({ enableTypes: ['xml'] })).use(koaAdapter(yoo.callback())).listen(8123)

console.log('Started!')

Options

new Yoo({
  token: 'Token',
  key: 'EncodingAESKey',
  appid: 'AppId',
  secret: 'AppSecret',
  autoFetchAccessToken: false,
  accessTokenCacheFile: '.yoo-access-token.json'
})

Author

Shirasawa

License

MIT

Package Sidebar

Install

npm i wechat-yoo

Weekly Downloads

6

Version

0.1.3

License

MIT

Unpacked Size

24.8 kB

Total Files

11

Last publish

Collaborators

  • ncbql