nodester-json-rpc
v0.0.1
Published
JSON-RPC middleware for nodester.
Downloads
6
Readme
nodester JSON-RPC
JSON-RPC middleware for nodester.
- Follows JSON-RPC 2.0 Specification
Installation
Install with NPM
npm install -S nodester-json-rpc
Usage
nodester-json-rpc
can only be used with a nodester router:
const Router = require('nodester/router');
const rpc = require('nodester-json-rpc/rpc');
const Path = require('path');
// For example: ../src/app/providers/Users.provider.js
const providersPath = Path.join(process.cwd(), 'src', 'app', 'providers');
const router = new Router({ providersPath });
// Define a route.
router.add.route(
v1('post /rpc/users'),
rpc({ providedBy: 'Users' })
);
Then make a POST
request with a body
formatted like this:
{
"jsonrpc": "2.0",
"id": 1,
"method": "blockById",
"params": {
"id": 24232
}
}
License
Copyright
Copyright 2024-present Mark Khramko