Last active
February 23, 2021 04:15
-
-
Save ktwrd/25974d59e2ad11dbb786ed0bbdff16ec to your computer and use it in GitHub Desktop.
Temporary HTTP Server
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
/* | |
This is only meant for use where you are testing if a server can recieve HTTP requests. | |
*/ | |
const http = require("http"); | |
const toolbox = require("tinytoolbox") | |
const port = parseInt(toolbox.stringGen(5,7)); | |
http.createServer(function (req, res) { | |
// console.log(req); | |
console.log(req.headers); | |
console.log(req.connection.remoteAddress); | |
res.write("Pong!"); | |
res.end(); | |
}).listen(port); | |
console.log(`[Debug] Started HTTP server on port '${port}'`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment