@fazzaamiarso
Posted
Hi @frbarbre! Nice Solution!
I have a tip for you.
When constructing a URL, it's better to utilize URL constructor to prevent Character Encoding problem. Here's the refactored code
const baseUrl = "https://geo.ipify.org/api/v2/";
const searchIpURL = new URL("country,city", baseUrl);
searchIpURL.searchParams.append("apiKey", process.env.API_KEY)
searchIpURL.searchParams.append("ipAddress", params.IPaddress)
const searchIpData = await fetch(searchIpURL);
I hope it's useful! Cheers!