Skip to content

Instantly share code, notes, and snippets.

@pesterhazy
Created Jan 19, 2021
Embed
What would you like to do?
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