I want to write function in models to get user ip , and want to store in user table has column name ip_address in node js. (using express, mysql)
  User.prototype.userip= function(req, res)
  {
    // here need access to IP address here
  }
I want to write function in models to get user ip , and want to store in user table has column name ip_address in node js. (using express, mysql)
  User.prototype.userip= function(req, res)
  {
    // here need access to IP address here
  }
I recommend you to use os
API from os to get IPv4
var os = require('os');
var networkInterfaces = os.networkInterfaces();
console.log( networkInterfaces );
var ip = require("ip");
console.dir ( ip.address() );
