Basically I am trying to invoke a lambda function from an API Gateway. The API is called from an index.html file I made that calls the api with a button click and returns values (ideally the weather). I can get it to return some text values but whenever I try to actually call an API with the lambda function using node-fetch function it gives me an error saying "cannot find node-fetch module."
const fetch = require('node-fetch')
module.exports.getTulsaCurrentWeather = (event, context, callback) => {
//API endpoint
const endpoint = `http://api.openweathermap.org/data/2.5/weather?
APPID=${process.env.APPID}&q=Tulsa&units=imperial`;
fetch(endpoint)
.then( res => res.json() )
.then( body => {
const response = {
statusCode: 200,
headers: {
"Access-Control-Allow-Origin" : "*",
},
body: JSON.stringify({ temperature: body.main.temp })
};
callback(null, response);
});
};