node-rpc
Simple ExpresJS middleware for RPC over Http.
let's say we would like to provide add & multiply functions to browser over RPC
var remoteObj = { // access expressjs session like this... //var session = this.request.session; ; } { ; } ;
Create RPC middlware & configure in your ExpressJs application.
var rpcMiddleware = ; app;
Include helper script in html file ( here /rpc/helper.js file is auto generated by node-rpc)
<script src="/rpc/helper.js" type="text/javascript"></script>
Call the add or multiply functions as needed.
<script type="text/javascript"> var rpc = '/rpc'; rpc; </script>
Note 1: All functions exposed in server needs to be async & last parameter should be a callback(err, result)