nodejs 微信公众号开发
--------## 中间件wechat.js有个方法reply ##
Wechat.prototype.reply = function(){
var content=this.body;
var message=this.weixin;
var xml=util.tpl(content,message);
this.status=200;
this.type='application/xml';
this.body=xml;
}
module.exports = Wechat;
----------## 在g.js文件中实例化这个函数并调用 ##
var sha1 = require('sha1')
var Wechat = require('./wechat')
var getRawBody = require('raw-body')
var util = require('./util')
var weixin = require('../weixin')
module.exports = function(opts){
var wechat = new Wechat(opts)
console.log(wechat)
wechat.reply.call(this)
出现这样的错误
TypeError: Cannot read property 'call' of undefined
at D:\www\nodejs\Projects\wechat\wechat\g.js:63:17
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
并且 wechat.reply 打印是未定义
中间件wechat.js中的wechat函数中return关键字删除