hono-cluster
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

hono-cluster

CI NPM Version MIT License Install Size

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.

Package Sidebar

Install

npm i hono-cluster

Weekly Downloads

9

Version

1.0.1

License

MIT

Unpacked Size

12.2 kB

Total Files

6

Last publish

Collaborators

  • shahradelahi