Hello there! I am trying to send the client's IP address from the frontend in a Next.js application to the backend.
To retrieve the IP, I am using the following function:
async function getIP() {
var clientIP = await publicIp.v4();
return clientIP;
}
export default getIP;
and then sending it using axios post.
getIP().then(ipAddress => {
axios.post('/api/ip', {
body: ipAddress
}). then((res) => {}...}
The server is able to display the IP address in the console, but...
var receivedIP = req.body;
console.log(receivedIP); // ***undefined***