Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wechat-router

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wechat-router

wechat-router ============= wechat-router是一个基于[node-wechat](https://github.com/node-webot/wechat)的微信路由中间件,用法类似express的router ## Installation

  • 0.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

wechat-router

wechat-router是一个基于node-wechat的微信路由中间件,用法类似express的router

Installation

$ npm install wechat-router

Use with Connect/Express

const wechat = require('wechat');
const Router = require('wechat-router');

const config = {
  token: 'token',
  appid: 'appid',
  encodingAESKey: 'encodinAESKey'
};

let router = new Router();

router.text('hello', (req, res, next)=> {
  res.reply('word');
});

let anotherRouter = new Router();

anotherRouter.event({EventKey: '123456'}, (req, res, next)=> {
  res.reply({
    type: "music",
    content: {
      title: "来段音乐吧",
      description: "一无所有",
      musicUrl: "http://mp3.com/xx.mp3",
      hqMusicUrl: "http://mp3.com/xx.mp3",
      thumbMediaId: "thisThumbMediaId"
    }
  })
});

function midDeal(req, res, next) {
  //do something
  next();
}

router.event({Event: 'SCAN'}, midDeal, anotherRouter);

app.use(express.query());
app.use('/wechat', wechat(config, router));

##TODO

  • 对话模式
  • Koa/Co版

License

The MIT license.

FAQs

Package last updated on 21 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc