Skip to content
Submitted about 1 month ago

IP-Address-Tracker

express, node
LVL 3
@argie002
A solution to the IP Address Tracker challenge

Solution retrospective


What are you most proud of, and what would you do differently next time?

I'm most proud of adding server-side caching with node-cache to reduce unnecessary requests to the API. Since geolocation data for a given IP or domain doesn't change often, caching results for 24 hours meant repeated searches, page refreshes, or revisits didn't waste API calls — which mattered since I was working with a free-tier API key with limited monthly requests. and Building a small Node/Express backend to proxy the API requests, keeping my API key hidden server-side instead of exposing it in the client-side JavaScript — a more production-appropriate approach than just calling the API directly from the browser.

What challenges did you encounter, and how did you overcome them?

One challenge was capturing each visitor's real IP address to use as a cache key, since requests go through my own server rather than directly from the browser. I solved this by reading the x-forwarded-for header and extracting the first IP in that chain.

Another challenge was that the search bar looked messy when users pasted a full URL instead of a plain domain. I fixed this by extracting just the hostname from the pasted text, so the search bar stays clean regardless of what's pasted.

Code
Loading...

Please log in to post a comment

Log in

Community feedback

No feedback yet. Be the first to give feedback on Argie Mariano’s solution.

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord