Last active
November 6, 2018 09:28
-
-
Save evgenius/f8337dabd776b5a373f1633a80fa89a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'); | |
const requestHandler = (req, res) => { | |
const { remoteAddress, remotePort } = req.socket; | |
console.log(`Got a request from ${remoteAddress}:${remotePort}`); | |
res.end('Hello'); | |
}; | |
const server = http.createServer(requestHandler); | |
const port = 8000; | |
server.listen(port, () => { | |
console.log(`Listening on the port ${port}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment