nodester-json-rpc

0.0.1 • Public • Published

nodester JSON-RPC

NPM version License

JSON-RPC middleware for nodester.

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

MIT

Copyright

Copyright 2024-present Mark Khramko

/nodester-json-rpc/

    Package Sidebar

    Install

    npm i nodester-json-rpc

    Weekly Downloads

    1

    Version

    0.0.1

    License

    MIT

    Unpacked Size

    8.69 kB

    Total Files

    10

    Last publish

    Collaborators

    • markkhramko