I am working a small webapp to teach myself some gcloud and js. currently am trying to send a get request from a google cloud function using axios to a web api. any guidance would be greatly appreciated.
the web api needs the following parameters in the header Accept:application/json APIKey: APIKEY
I've been trying to use the code in How to set header and options in axios? and axios info, but I keep getting errors (SyntaxError: Unexpected token)
Index.JS currently looks like so
const axios = require("axios");
exports.run = async(req, res) => {
axios.get('APIURL', {
headers: {
'Accept': 'application/json';
'APIKey': 'KEY'
}
}).then((response) => {
res.status(200).send(response.data);
console.log(response);
}, (error) => {
res.status(500).send(response.data);
console.log(error);
});
};
package.json
{
"name": "YOUR_NAME",
"version": "0.0.1",
"dependencies": {
"axios": "^0.19.2"
}
}