Hi, you are directly fetching the api from your js file instead you have to send a request to the token-hider.js like this
const res = await fetch("/.netlify/functions/token-hider" + "?q=" + searchField.value). I have used the fetch api but you can use axios if you prefer it.
Can you send the token-hider.js file so that I can take a look and see what's the problem.
Thanks for your response, but the code above is code before I implemented it in token-hider.js (my current code). I don't know how to change it in token-hider.js. Your tutorial (and all the tutorials I read on Google) uses an API that puts the key in a parameters, while the API I use is in the headers.
Aadhi Keerthanan
Dumi
Hello, I found your article very useful. But, what if the API use the key in headers, not parameters? This is the example how I get data from the API:
const BASE_URL = "....."; const ENDPOINTS = "/type=movie"; // There is more than one endpoint, it's dynamic const API_KEY = { headers: { "key": "value"; } }; axios.get(`${BASE_URL}${ENDPOINTS}`, API_KEY).then(........