{"id":15797280,"url":"https://github.com/pyrite-framework/pyrite-server-emitter","last_synced_at":"2026-04-17T01:02:21.123Z","repository":{"id":143806399,"uuid":"106748011","full_name":"pyrite-framework/pyrite-server-emitter","owner":"pyrite-framework","description":"pyrite-server emitter plugin","archived":false,"fork":false,"pushed_at":"2017-10-18T22:57:10.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-25T14:27:13.054Z","etag":null,"topics":["pyrite-server","socket-io"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/pyrite-framework.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-12T21:38:01.000Z","updated_at":"2017-10-24T13:43:53.000Z","dependencies_parsed_at":"2023-07-11T14:35:19.614Z","dependency_job_id":null,"html_url":"https://github.com/pyrite-framework/pyrite-server-emitter","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"f79b338b41a0ee6bb0ef7eebb15f2341b247336c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pyrite-framework/pyrite-server-emitter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrite-framework%2Fpyrite-server-emitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrite-framework%2Fpyrite-server-emitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrite-framework%2Fpyrite-server-emitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrite-framework%2Fpyrite-server-emitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyrite-framework","download_url":"https://codeload.github.com/pyrite-framework/pyrite-server-emitter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrite-framework%2Fpyrite-server-emitter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268654327,"owners_count":24285122,"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","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["pyrite-server","socket-io"],"created_at":"2024-10-05T00:06:08.578Z","updated_at":"2026-04-17T01:02:21.021Z","avatar_url":"https://github.com/pyrite-framework.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyrite-server-emitter\n\n## Install\n\n- Decorators feature has to be enabled.\n\n```\nnpm install pyrite-server\nnpm install pyrite-server-emitter\n```\n\n## Example\n\n### main.js\n\n```typescript\nimport { PyriteServer } from \"pyrite-server\";\nimport { EmitterPlugin } from \"pyrite-server-emitter\";\n\nconst server = new PyriteServer({\n  port: 8000,\n  routes: \"/routes\",\n  plugins: [new EmitterPlugin()]\n});\n\nserver.listen(() =\u003e {\n  console.log(\"Server running!\");\n});\n```\n\n### /routes folder:\n  ### users.js\n  \n```typescript\nimport { \n  Route, Get, Post, Put, Delete, Exception, Body, Params, Query\n} from \"pyrite-server\";\n\nimport { \n  Emits, Emit, Broadcast\n} from \"pyrite-server-emitter\";\n\n\nconst users = [];\nlet index = 0;\n\n@Route(\"/users\")\nexport class Users {\n  @Get(\"/\")\n  getUsers(@Query(\"name\") name) {\n    const result = users.filter((user) =\u003e !name || user.name === name);\n    \n    return result;\n  }\n\n  @Post(\"/\")\n  @Broadcast\n  createUser(@Body user, @Emit emit) {\n    user.id = index++;\n\n    users.push(user);\n\n    emit(user);\n    \n    return user;\n  }\n\n  @Put(\"/:id\", Number)\n  @Broadcast\n  updateUser(@Body user, @Emit emit) {\n    const foundUser = users.find((localUser) =\u003e localUser.id === user.id);\n    if (!user) throw Exception(404, \"not_found\");\n\n    Object.assign(foundUser, user);\n\n    emit(user);\n\n    return user;\n  }\n\n  @Delete(\"/:id\", Number)\n  @Emits\n  removeUser(@Params(\"id\") id, @Emit emit) {\n    const indexUser = users.findIndex((user) =\u003e user.id === id);\n    if (indexUser === -1) throw Exception(404, \"not_found\");\n\n    users.splice(indexUser, 1);\n\n    emit(id);\n\n    return true;\n  }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyrite-framework%2Fpyrite-server-emitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyrite-framework%2Fpyrite-server-emitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyrite-framework%2Fpyrite-server-emitter/lists"}