# jsonrpc-express

> JSON RPC express middleware server

Latest version **1.0.5** (published 2015-02-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install jsonrpc-express
pnpm add jsonrpc-express
yarn add jsonrpc-express
bun add jsonrpc-express
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2015-02-11 |
| First published | 2015-02-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.6 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| Author | Victor Bucataru |
| Maintainers | devktor |
| Keywords | jsonrpc, rpc, express, middleware |

## Links

- npm: https://www.npmjs.com/package/jsonrpc-express
- Repository: https://github.com/devktor/jsonrpc-express
- Issues: https://github.com/devktor/jsonrpc-express/issues
- npm.io page: https://npm.io/package/jsonrpc-express

## Dependencies (1)

- [coffee-script](https://npm.io/package/coffee-script.md) *

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.5 (latest) — 2015-02-11
- 1.0.4 — 2015-02-10
- 1.0.3 — 2015-02-10
- 1.0.2 — 2015-02-10
- 1.0.1 — 2015-02-10
- 1.0.0 — 2015-02-10

## README

##jsonrpc-express
JSON RPC server as express middleware.

###installation
```bash
npm install jsonrpc-express
```

###usage

Include library
```javascript
RPCServer = require("jsonrpc-express");
```
Create server object
```javascript
var server = new RPCServer({echo:function(args){return {result:args};});
```
or without arguments
```javascript
var server = new RPCServer();
```

Register some methods
```javascript
server.register("ping", function(args){ return "pong";})
```

or bulk register
```javascript
server.register({ping:function(args){return "pong";}, time:function(args){return Date.now();}}
```

Optionally set authentication handler.
```javascript
server.setBasicAuth(function(username, password){
    return true; //will accept all passwords
})
```

Use it as middleware. Multiple server instances can be declared.
```javascript
var app = express();
app.use("/api", server);
```

---
_Source: https://npm.io/package/jsonrpc-express · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
