hono-cluster
v1.0.0
Published
Lightweight clustering and static file serving for Hono apps on NodeJs.
Downloads
77
Maintainers
Readme
hono-cluster
hono-cluster is a lightweight module for running Hono applications with optional clustering support. It allows you to efficiently utilize multiple CPU cores by spawning worker processes.
📦 Installation
npm install hono-cluster
📖 Usage
Starting a Clustered Server
// -- server.ts
import { serve } from 'hono-cluster';
import { App } from './app';
serve(
{
fetch: App.fetch,
port: 3000,
workers: true, // Use all available CPU cores
},
(_server, info) => {
console.log(`Listening on http://${info.address}:${info.port}`);
}
);
Serving Static Files
import { Hono } from 'hono';
import { serveStatic } from 'hono-cluster';
const App = new Hono();
App.use('*', serveStatic({ root: './public' }));
// ...
📚 Documentation
For all configuration options, please see the API docs.
🤝 Contributing
Want to contribute? Awesome! To show your support is to star the project, or to raise issues on GitHub
Thanks again for your support, it is much appreciated! 🙏
License
MIT © Shahrad Elahi and contributors.