Search code examples
node.jsrestify

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


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?
}

Solution

  • This worked:

    req.connection.remoteAddress