Skip to content

Instantly share code, notes, and snippets.

View bozzelliandrea's full-sized avatar
🦥
trying to break things

Andrea Bozzelli bozzelliandrea

🦥
trying to break things
View GitHub Profile
@Cadienvan
Cadienvan / cluster-reverse-proxy.js
Last active February 20, 2023 06:28
How to create a reverse proxy using clusters in Node.js
const cluster = require('cluster');
const http = require('http');
if (cluster.isMaster) {
for (let i = 0; i < 10; i++) {
cluster.fork();
}
let workers = Object.values(cluster.workers)
cluster.on('exit', (worker, code, signal) => {