Created
January 19, 2021 20:50
-
-
Save pesterhazy/41f77118c7d6c7821cbce841db4fba4e to your computer and use it in GitHub Desktop.
slothjs
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 { createServer } = require("http"); | |
const PORT = 22002; | |
const server = createServer(); | |
server.on("request", (request, response) => { | |
response.write("Hello, world!\n"); | |
}); | |
server.listen(PORT, () => { | |
console.log(`starting server at port ${PORT}`); | |
}); | |
let count = 0; | |
let killMs = parseInt(process.argv[2]); | |
setInterval( () => { | |
count ++; | |
console.log(count); | |
if ( count === killMs ) { | |
process.exit(); | |
} | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment