这是云中的功能:
/**
* Responds to any HTTP request that can provide a "message" field in the body.
*
* @param {!Object} req Cloud Function request context.
* @param {!Object} res Cloud Function response context.
*/
exports.helloWorld = function helloWorld(req, res) {
// Example input: {"message": "Hello!"}
if (req.body.message === undefined) {
// This is an error case, as "message" is required.
res.status(400).send('No message defined!');
} else {
// Everything is okay.
console.log(req.body.message);
res.status(200).send('Success: ' + req.body.message);
}
};
如何将JSON添加到URL的末尾以将消息传递给函数... 该函数的URL是 https://us-central1-internal-156105.cloudfunctions.net/myapp
答案 0 :(得分:0)
使用"结束"
res.end(req.body.message)