Skip to content

Instantly share code, notes, and snippets.

@pesterhazy
Created January 19, 2021 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pesterhazy/41f77118c7d6c7821cbce841db4fba4e to your computer and use it in GitHub Desktop.
Save pesterhazy/41f77118c7d6c7821cbce841db4fba4e to your computer and use it in GitHub Desktop.
slothjs
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