我将一些变量导出为nodejs中的一个函数,如下所示:
app.js:
var setting;
var savesetting = function(val, callback){ .....}
module.export =setting;
module.export = savesetting;
index.js:
var appjs = require('app');
appjs.savesettings(0,1);
appjs.savesettings();导致错误:
Express
500 TypeError: Object #<Object> has no method 'savesettings'
任何想法?
答案 0 :(得分:1)
var app = {
setting:{},
savesetting : function(val, callback){ .....}
}
module.exports = app;