API proxy server to hide the API key used to make a call to a third-party API using Node.js. Added rate limiting to avoid spamming and caching for improved performance
Generally, when we make a call to a public API (like the Open Weather API in this case), we can see the API key on the client side, like this:
By making an API proxy server, we hide the API key & store it on the client side. So our client side looks something like this:
Rate limiting is used to limit network traffic. It puts a cap on how often someone can repeat an action within a certain time period – in this example, trying to hit the weather API. Rate limiting can help stop certain kinds of malicious bot activity.
Caching refers to storing frequently accessed data in a cache to reduce the need for expensive computations or external API calls, resulting in faster response times and lower server loads.