https://github.com/steemit/koa-jsonrpc
https://github.com/steemit/koa-jsonrpc
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/steemit/koa-jsonrpc
- Owner: steemit
- Created: 2017-09-18T22:01:39.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-02-01T20:11:20.000Z (over 8 years ago)
- Last Synced: 2025-04-11T04:41:56.625Z (about 1 year ago)
- Language: TypeScript
- Size: 79.1 KB
- Stars: 9
- Watchers: 17
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
@steemit/koa-jsonrpc
====================
*Build status: [](https://circleci.com/gh/steemit/koa-jsonrpc)*
Spec compliant JSON RPC Server middleware for Koa
```javascript
const Koa = require('koa')
const {JsonRpc} = require('@steemit/koa-jsonrpc')
const rpc = new JsonRpc()
rpc.register('my_method', async (foo, bar) => {
return foo + bar
})
const app = new Koa()
app.use(rpc.middleware)
app.listen(8080)
```
```
$ curl -X POST -d '{"id":1,"jsonrpc":"2.0","method":"my_method","params":["honkey","tonk"]}' localhost:8080
{"jsonrpc":"2.0","id":1,"result":"honkeytonk"}
```