Home > database >  Is there a way to call API not on client side?
Is there a way to call API not on client side?

Time:06-07

Currently in my site, the API Call is in the client-side JavaScript meaning that anyone can spam refresh and use up the limited amount of API Calls (At least I assume that is how it works).

I am new and I want to know if I can call the API Locally and then push that data to the client end.

Here is the format of my API Calls:

const res = await fetch(`https://link.com`, {
        headers: {
            'X-RapidAPI-Host': "link",
            "X-RapidAPI-Key": "key"
        }, 
    });

I am currently using simple JavaScript with jQuery. Node.js, AWS or some other services may be required for what I want but I am not sure, any help would be amazing. I have tried seeking answers to this question but was not able to find anything that made any sense.

CodePudding user response:

Here's a helpful article on caching API requests. This method is done client side and should be suitable for your question: https://dev.to/adancarrasco/caching-api-requests-in-javascript-mc4

  • Related