2.0.0 • Published 2 years ago
@stricjs/cluster v2.0.0
@stricjs/cluster
A cluster implementation for Bun.
Install
bun i @stricjs/cluster
Usage
import { worker, spawn } from '@stricjs/cluster';
// If current module is a worker
if (worker) Bun.serve({
fetch: () => new Response('Hi'),
// Must use this
reusePort: true
});
// Spawn a number of threads equivalent to available hardware concurrency
else spawn();