{"id":15046544,"url":"https://github.com/yujuiting/jtrpc","last_synced_at":"2025-02-28T22:25:17.478Z","repository":{"id":57123166,"uuid":"160801916","full_name":"yujuiting/jtrpc","owner":"yujuiting","description":"json rpc server","archived":false,"fork":false,"pushed_at":"2018-12-08T14:39:47.000Z","size":70,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-23T09:38:52.784Z","etag":null,"topics":["jsonrpc2","koa","nodejs","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yujuiting.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-07T09:28:48.000Z","updated_at":"2018-12-08T14:41:00.000Z","dependencies_parsed_at":"2022-08-24T14:56:51.142Z","dependency_job_id":null,"html_url":"https://github.com/yujuiting/jtrpc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yujuiting%2Fjtrpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yujuiting%2Fjtrpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yujuiting%2Fjtrpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yujuiting%2Fjtrpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yujuiting","download_url":"https://codeload.github.com/yujuiting/jtrpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241255883,"owners_count":19934944,"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":["jsonrpc2","koa","nodejs","typescript"],"created_at":"2024-09-24T20:53:13.458Z","updated_at":"2025-02-28T22:25:17.455Z","avatar_url":"https://github.com/yujuiting.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jtrpc\n\nA json rpc server framework.\n\n## install\n\n```\n$ npm install typedi koa koa-bodyparser @jtrpc/core @jtrpc/koa\n```\n\n## quick start\n\n```typescript\nimport { Service } from 'typedi';\nimport * as Koa from 'koa';\nimport * as bodyparser from 'koa-bodyparser';\nimport jtrpc from '@jtrpc/koa';\nimport { MethodInstance } from '@jtrpc/core';\n\nconst app = new Koa();\n\napp.use(bodyparser());\n\napp.use(jtrpc({\n  methodResolver: method =\u003e {\n    switch (method) {\n      case 'math.sum': return Sum;\n    }\n  },\n}));\n\napp.listen(3000, () =\u003e console.log('server up'));\n\n@Service('ping')\nclass Ping extends MethodInstance {\n  execute() {\n    return 'pong';\n  }\n\n  validateParameters() {\n    return true;\n  }\n}\n\n@Service()\nclass Sum extends MethodInstance\u003cnumber[], number\u003e {\n  execute(...values: number[]) {\n    return values.reduce((acc, curr) =\u003e acc + curr, 0);\n  }\n\n  validateParameters(...values: unknown[]) {\n    return values.every(value =\u003e typeof value === 'number');\n  }\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyujuiting%2Fjtrpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyujuiting%2Fjtrpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyujuiting%2Fjtrpc/lists"}