Created
April 13, 2023 13:25
-
-
Save ferdousulhaque/8b5a7a3b21d2d9871af8a914fb1c6e74 to your computer and use it in GitHub Desktop.
Listener script with node to test server port opening
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 host = process.argv.slice(2)[0]; | |
const port = process.argv.slice(2)[1]; | |
const requestListener = function (req, res) { | |
res.writeHead(200); | |
res.end("Success!!"); | |
}; | |
const server = http.createServer(requestListener); | |
server.listen(port, host, () => { | |
console.log(`Server is running on http://${host}:${port}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment