jsonrpc2-express: JSON-RPC end-point for express
Module to configure an express router in order to expose a JSON-RPC end-point.
Installation
npm install jsonrpc2-express
Usage
const express = ;const jsonrpc = const app = ; let routerRpc = express; ; app; app;
The file module1.js
with the implementation of the different methods is:
exports { console return field1: 'answer from f1' user: requser ;}; exports { console return field1: 'answer from f2' user: requser ;}; exports { throw "sorry";};
The parameters for each method can be read from req.body.params
Tests
npm test
Contributing
In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.