jsonrpc-express
JSON RPC express middleware server
Last updated 5 years ago by devktor .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install jsonrpc-express 
SYNC missed versions from official npm registry.

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

###installation

npm install jsonrpc-express

###usage

Include library

RPCServer = require("jsonrpc-express");

Create server object

var server = new RPCServer({echo:function(args){return {result:args};});

or without arguments

var server = new RPCServer();

Register some methods

server.register("ping", function(args){ return "pong";})

or bulk register

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

Optionally set authentication handler.

server.setBasicAuth(function(username, password){
    return true; //will accept all passwords
})

Use it as middleware. Multiple server instances can be declared.

var app = express();
app.use("/api", server);

Current Tags

  • 1.0.5                                ...           latest (5 years ago)

6 Versions

  • 1.0.5                                ...           5 years ago
  • 1.0.4                                ...           5 years ago
  • 1.0.3                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2014 - 2017 © taobao.org |