How can I get the client IP from a request object with Restify?

Coder1 picture Coder1 · Jan 26, 2015 · Viewed 8.2k times · Source

I'm having a difficult time finding how to access the IP address of the REST client from a route.

server.get('api/foo', function(req, res, next) {
    // How can I access the IP address of the requester from here?
}

Answer

Coder1 picture Coder1 · Jan 26, 2015

This worked:

req.connection.remoteAddress