@konceiver/hapi-json-rpc
v2.0.0
Published
An implementation of the JSON-RPC 2.0 specification for building RPCs with hapi.js
Downloads
8
Readme
@konceiver/hapi-json-rpc
This package was created by, and is maintained by Brian Faust, and is a package provides an implementation of the JSON-RPC 2.0 specification for building RPCs with hapi.
Installation
yarn add @konceiver/hapi-json-rpc
Usage
Joi (Default)
import * as plugin from "@konceiver/hapi-json-rpc";
import Joi from "@hapi/joi";
await server.register({
plugin,
options: {
methods: [...],
processor: {
schema: Joi.object().keys({
id: Joi.alternatives().try(Joi.number(), Joi.string()).required(),
jsonrpc: Joi.string().allow("2.0").required(),
method: Joi.string().required(),
params: Joi.object(),
}),
validate(data: object, schema: object) {
return Joi.validate(data, schema);
},
},
},
});
Testing
yarn test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover a security vulnerability within this package, please send an e-mail to [email protected]. All security vulnerabilities will be promptly addressed.
Credits
This project exists thanks to all the people who contribute.
Support Us
We invest a lot of resources into creating and maintaining our packages. You can support us and the development through GitHub Sponsors.
License
hapi JSON-RPC is an open-sourced software licensed under the MIT.