Я пытаюсь включить заголовок CORS в моей функции Lambda / Node JS. Я попытался включить CORS в шлюзе API, но это не работает. Любая идея, код функции My nodeJS / Lambda выглядит следующим образом:
exports.handler = async (event) => {
if (event.httpMethod === 'GET') {
return getData(event);
}
};
const getData = event => {
let data = {
"home": [{
"title": "John Doe title",
"body": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.",
"image": "image/example.jpg"
}
],
"about": [{
"title": "John is the main part 1",
"body": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.",
"image": "image/example.jpg"
}
]
};
return {
statusCode: 200,
body: JSON.stringify(data, null, 2)
};
};