index.js
function(action, method, sysImports, options, channel, req, res) {
    var self = this;

    if (this.actions[action] && (this.actions[action].rpc || 'invoke' === method)) {
      if ('invoke' === method) {
        var imports = (req.method === 'GET' ? req.query : req.body);

        // @todo add files support
        this.actions[action].invoke(imports, channel, sysImports, [], function(err, exports) {
          if (err) {
            self.log(err, channel, 'error');
          }

          res.contentType(DEFS.CONTENTTYPE_JSON);
          if (err) {
            res.send(err, 500);
          } else {
            res.send(exports);
          }
        });
      } else {
        this.actions[action].rpc(method, sysImports, options, channel, req, res);
      }
    } else {
      res.send(404);
    }
  }
function(action, method, sysImports, options, channel, req, res) {
    var self = this;

    if (this.actions[action] && (this.actions[action].rpc || 'invoke' === method)) {
      if ('invoke' === method) {
        var imports = (req.method === 'GET' ? req.query : req.body);

        // @todo add files support
        this.actions[action].invoke(imports, channel, sysImports, [], function(err, exports) {
          if (err) {
            self.log(err, channel, 'error');
          }

          res.contentType(DEFS.CONTENTTYPE_JSON);
          if (err) {
            res.send(err, 500);
          } else {
            res.send(exports);
          }
        });
      } else {
        this.actions[action].rpc(method, sysImports, options, channel, req, res);
      }
    } else {
      res.send(404);
    }
  }
function ( action , method , sysImports , options , channel , req , res ) { var self = this ; if ( this . actions [ action ] && ( this . actions [ action ] . rpc || 'invoke' === method ) ) { if ( 'invoke' === method ) { var imports = ( req . method === 'GET' ? req . query : req . body ) ; // @todo add files support this . actions [ action ] . invoke ( imports , channel , sysImports , [ ] , function ( err , exports ) { if ( err ) { self . log ( err , channel , 'error' ) ; } res . contentType ( DEFS . CONTENTTYPE_JSON ) ; if ( err ) { res . send ( err , 500 ) ; } else { res . send ( exports ) ; } } ) ; } else { this . actions [ action ] . rpc ( method , sysImports , options , channel , req , res ) ; } } else { res . send ( 404 ) ; } }
RPC's are direct calls into a pod, so its up to the pod
to properly authenticate data etc.
RPC s are direct calls into a pod so its up to the pod to properly authenticate data etc .