Launch Week Day 1: Socket for Jira Is Now Available.Learn More
Socket
Book a DemoSign in
Socket

express-jr2

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-jr2

Create a JSON-RPC 2.0 compliant HTTP server with jr2 and Express

latest
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

jr2 HTTP Server Middleware

Create a JSON-RPC 2.0 compliant HTTP server with jr2 and Express.

Installation

npm install --save express-jr2

Setup

const express = require('express')
const bodyParser = require('body-parser')
const jr2HTTP = require('express-jr2')

const delegate = {
    sum(params, { responseWithResult }, callback) {
        const result = params.reduce((a, b) => a + b, 0)
        callback(null, responseWithResult(result))
    },
}
const app = express()

app
    .use(bodyParser.json())
    .use('/rpc', jr2HTTP(delegate))

app.listen(3000)

License

MIT

Keywords

jsonrpc

FAQs

Package last updated on 23 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts