how to send response to a specific ip address in nodejs or javascript?

I am working with nodejs, and i want to send response from server to a specific ip address but server will be able to listen request from any ip address. Please suggest me how to do this. thanks in advance.

Your question is not very clear and also didn't give any code example of what you have tried. Anyway here is a basic code showing how to get the ipaddress of the client that requested the server and send a response back based in the ip address:

var http = require('http');

var s = http.createServer(function(req, res){
     var ipAddress = req.connection.remoteAddress;
     //check if user is accessing from localhost ip
     if(ipAddress=="127.0.0.1"){
        res.writeHead(200, {'content-type':'text/plain'})
        res.end('Hello localhost');     
     } else {
        res.writeHead(200, {'content-type':'text/plain'})
        res.end('Hello '+ipAddress);
     }
});
s.listen(8000);