npm install request-ipconst requestIp = require('request-ip'); // inside middleware handler const ipMiddleware = function(req, res, next) { const clientIp = requestIp.getClientIp(req); next(); }; // on localhost you'll see 127.0.0.1 if you'
// inside middleware handler
const ipMiddleware = function(req, res, next) {
const clientIp = requestIp.getClientIp(req);
next();
};
// on localhost you'll see 127.0.0.1 if you're using IPv4
// or ::1, ::ffff:127.0.0.1 if you're using IPv6