以下是相关代码,但是一直无法成功,由于文档没有相关内容,不知道该如何解决!
const fetch = require('node-fetch');
module.exports.handler = async function(event, context, callback) {
var request = JSON.parse(event);
var page = request.queryParameters.page;
var id = request.queryParameters.id;
try {
const apiResponse = await fetch('https://www.thecolorapi.com/id?hex=ff758c');
const apiData = await apiResponse.json();
console.log(apiData);
const responseObject = {
isBase64Encoded: false,
statusCode: 200,
headers: {
"Content-type": "application/json; charset=utf-8"
},
body: JSON.stringify(apiData)
};
if (page == 2 && id == 3) {
callback(null, responseObject);
}
} catch (err) {
console.error(err);
callback(err);
}
};
CreateSpace – 创建小程序服务空间,看一下相关的参数配置:https://help.aliyun.com/document_detail/456957.htm?spm=a2c4g.11186623.0.0.5a972829llR6Vq