Skip to content

Instantly share code, notes, and snippets.

@wolmi
Last active October 30, 2019 14:44
// server.js
const http = require('http');
const pid = process.pid;
http.createServer((req, res) => {
for (let i=0; i<1e7; i++); // simulate CPU work
res.end(`Handled by process ${pid}`);
}).listen(8080, () => {
console.log(`Started process ${pid}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment