rpc-node

Client rpc for nodejs

npm install rpc-node
2 downloads in the last week
4 downloads in the last month

rpc-node

Simple rpc for node/express

Like this..

app.js

    var express = require('express'), app = express();
    var server = require('http').createServer(app)
     server.listen(85);

     require('./rpc-node.js')(app, {
         '/rpc/gettime': function(params){
             return {e: null, r:new Date()}
         }
     })

     app.get('/', function(r,s){
         s.sendfile('index.html')
     })

index.html

<script src='/rpc'></script>
<div id='timeis'/>

<script>
    rpc('/rpc/gettime', function(e,r){
        console.log(r)
        document.getElementById('timeis').innerHTML = r;
    }, null)
</script>
npm loves you