Sha256: 8455ffd0d7a4ea5006cb01b38a068e24db6fadaaab278d22dfc0a77557cd6611
Contents?: true
Size: 930 Bytes
Versions: 26
Compression:
Stored size: 930 Bytes
Contents
/** * Module dependencies. */ var Connect = require('./../../lib/connect'); // curl -H "Content-Type: application/json" -d '{ "jsonrpc": "2.0", "method": "add", "params": [1,2], "id":2 }' http://localhost:3000 // curl -H "Content-Type: application/json" -d '{ "jsonrpc": "2.0", "method": "add", "params": { "b": 1, "a": 2 }, "id":2 }' http://localhost:3000 var math = { add: function(a, b){ try { this(null, a + b); } catch (err) { this(err); } }, sub: function(a, b){ try { this(null, a - b); } catch (err) { this(err); } } }; // curl -H "Content-Type: application/json" -d '{ "jsonrpc": "2.0", "method": "time", "id":2 }' http://localhost:3000 var date = { time: function(){ this(null, new Date().toUTCString()); } }; module.exports = Connect.createServer( Connect.jsonrpc(math, date) );
Version data entries
26 entries across 26 versions & 1 rubygems