node-webot / wechat

微信公共平台消息接口服务中间件
Other
5.11k stars 1.18k forks source link

如果没有指定图片或其它类型的处理,会不会执行 express 的下一个路由? #265

Closed memstone closed 7 years ago

memstone commented 7 years ago

app.use('/wx', wechat(wx_config, wechat.text((message, req, res, next) => { res.reply([{title:'demo', description:'skdkd', picurl:'http://images.csdn.net/20170322/no1.jpg', url:'http://geek.csdn.net/news/detail/188258' }]); }).event((message, req, res, next)=>{ console.log('evet...'); console.log(message); res.reply('hello event.'); })));

app.get('/wx', (req, res) => { console.log('not processed.'); res.reply('Your message not supported yet.'); });

以上的代码,不会执行 app.get,需要怎么编码?

nick-ma commented 7 years ago

The GET method can only be invoked once when you activated the Callback Mode at the Wechat console. However, all the callback actions that wechat server performs use POST method.

2017-03-23 14:51 GMT+08:00 memstone notifications@github.com:

app.use('/wx', wechat(wx_config, wechat.text((message, req, res, next) => { res.reply([{title:'demo', description:'skdkd', picurl:'http://images.csdn.net/20170322/no1.jpg', url:'http://geek.csdn.net/news/detail/188258' }]); }).event((message, req, res, next)=>{ console.log('evet...'); console.log(message); res.reply('hello event.'); })));

app.get('/wx', (req, res) => { console.log('not processed.'); res.reply('Your message not supported yet.'); });

以上的代码,不会执行 app.get,需要怎么编码?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/node-webot/wechat/issues/265, or mute the thread https://github.com/notifications/unsubscribe-auth/ABq-98yydTEXwRMuzj5AtOEqmAlnyv7bks5rohaIgaJpZM4MmTSg .

memstone commented 7 years ago

@nick-ma thank u very much. after change GET to POST, then it works.

nick-ma commented 7 years ago

You are welcome and issue closed.