title: Getting users' ip using nodejs and saving to database
body: <p>I have an issue. I want to store the ipv4 of a user in my database. For that I am using this external API called <a href="https://ipapi.co/json" rel="nofollow noreferrer">https://ipapi.co/json</a>.</p>
  <p>I am trying to implement the system. I have thought of a solution and it goes this way - On the website, as soon as a user visits a page, an ajax get request is made to that API which fetches the <code>user's ip</code> and stores it in an <code>input type= hidden</code> to which I can get access in <code>req.body</code> and store in the database.</p>
  <p>In order to avoid the user use chromedevtools to change that attribute I can add <code>oncontextmenu=&quot;return false&quot;</code> <code>onkeydown=&quot;return false;&quot;</code> <code>onmousedown=&quot;return false;&quot;</code> to the body so that user cannot get access to the chrome devtools.</p>
  <p>I am not sure if this will work out. Can you guys please suggest.</p>
  <p>Another doubt that I have is that is the ajax request is made by the user or by the server? If the server makes the request then IP will be of the server which is useless. Please help!</p>