node.js http request ip address 1

node.js http request ip address

request.connection.remoteAddress
//according to VSCode use:
request.socket.remoteAddress

Here is what the above code is Doing:
1. We’re importing the http module, which is part of the Node.js core.
2. We’re creating a server using the http module’s createServer() method.
3. We’re telling the server to listen on port 3000.
4. We’re telling the server to respond to any request with a message.
5. We’re telling the server to log the request to the console.

Similar Posts