{"id":13686689,"url":"https://github.com/fibjs-modules/cluster-server","last_synced_at":"2025-05-01T09:32:25.892Z","repository":{"id":73530137,"uuid":"90366026","full_name":"fibjs-modules/cluster-server","owner":"fibjs-modules","description":"Start a multi-thread server to take advantage of multi-core systems.","archived":false,"fork":false,"pushed_at":"2019-09-08T10:36:45.000Z","size":18,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-26T14:18:25.321Z","etag":null,"topics":["cluster","fibjs","multi-thread","server"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fibjs-modules.png","metadata":{"files":{"readme":"readme.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-05-05T10:43:45.000Z","updated_at":"2024-04-30T03:04:31.000Z","dependencies_parsed_at":"2023-04-10T17:49:25.121Z","dependency_job_id":null,"html_url":"https://github.com/fibjs-modules/cluster-server","commit_stats":{"total_commits":23,"total_committers":1,"mean_commits":23.0,"dds":0.0,"last_synced_commit":"26bbb1579fd6d98531c955c0dd0e922a97c2e0d6"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibjs-modules%2Fcluster-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibjs-modules%2Fcluster-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibjs-modules%2Fcluster-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibjs-modules%2Fcluster-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fibjs-modules","download_url":"https://codeload.github.com/fibjs-modules/cluster-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251852889,"owners_count":21654479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cluster","fibjs","multi-thread","server"],"created_at":"2024-08-02T15:00:37.945Z","updated_at":"2025-05-01T09:32:25.625Z","avatar_url":"https://github.com/fibjs-modules.png","language":"JavaScript","funding_links":[],"categories":["Packages"],"sub_categories":["Server App"],"readme":"# @fibjs/cluster-server\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![appveyor build status][appveyor-image]][appveyor-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![David deps][david-image]][david-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/@fibjs/cluster-server.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/@fibjs/cluster-server\n[travis-image]: https://img.shields.io/travis/fibjs-modules/cluster-server.svg?style=flat-square\n[travis-url]: https://travis-ci.org/fibjs-modules/cluster-server\n[appveyor-image]: https://ci.appveyor.com/api/projects/status/50xpe6gjlnlqnaxj/branch/master?svg=true\n[appveyor-url]: https://ci.appveyor.com/project/ngot/cluster-server\n[codecov-image]: https://img.shields.io/codecov/c/github/fibjs-modules/cluster-server.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/fibjs-modules/cluster-server?branch=master\n[david-image]: https://img.shields.io/david/fibjs-modules/cluster-server.svg?style=flat-square\n[david-url]: https://david-dm.org/fibjs-modules/cluster-server\n[snyk-image]: https://snyk.io/test/npm/@fibjs/cluster-server/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/@fibjs/cluster-server\n[download-image]: https://img.shields.io/npm/dm/@fibjs/cluster-server.svg?style=flat-square\n[download-url]: https://npmjs.org/package/@fibjs/cluster-server\n\nStart a multi-thread server to take advantage of multi-core systems.\n\n## Install\n\n```bash\n$ npm i @fibjs/cluster-server --save\n```\n\n## Usage\n\nserver.js :\n\n```js\nconst Cluster = require('@fibjs/cluster-server');\nconst path = require('path');\n\nconst server = new Cluster({\n  port: 8000,// server port,default to 8000\n  worker: path.join(__dirname, 'worker.js'), // full path to worker \n  numbers: 4,// default to cpu numbers\n});\n\nserver.run(); // start server asynchronously\n// server.close(); // close server\n```\n\nworker.js :\n\n```js\nmodule.exports = req =\u003e {\n  req.response.write('Hello, World!');\n};\n```\n\nthen you can start server:\n\n```bash\n  fibjs server.js\n```\n\n## worker.js\n\nWe can export any handler described at [http://fibjs.org/docs/manual/module/ifs/mq.md.html#Handler](http://fibjs.org/docs/manual/module/ifs/mq.md.html#Handler).\n\n## Questions \u0026 Suggestions\n\nPlease open an issue [here](https://github.com/fibjs-modules/cluster-server/issues).\n\n## License\n\n[MIT](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffibjs-modules%2Fcluster-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffibjs-modules%2Fcluster-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffibjs-modules%2Fcluster-server/lists"}