简体   繁体   中英

node.js Error generating response. TypeError: response.json is not a function

In my node app, I'm trying to return a simple object and getting this error in my console:

Error generating response. TypeError: response.json is not a function

code in my messaging.js file :

module.exports = {
    getConfig: function(res) {
        getConfig(res);
    }
};

function getConfig(response) {    
    response.json({
      enabledForAll: false,
      limit: 100
    });
};

In main.js

const messaging = require("./modules/messaging.js");
Parse.Cloud.define("getConfig", messaging.getConfig);

Any advice? Thanks

A parse FunctionResponse only has two properties. success and error .

Additionally, the data portion of the define callback has two function inputs, FunctionRequest and FunctionResponse , so you may need something like function(req,res){ res.success();}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM