How to use the strong-remoting.create function in strong-remoting

To help you get started, we’ve selected a few strong-remoting examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strongloop-community / loopback-sdk-android / test-server / remoting / index.js View on Github external
// Copyright IBM Corp. 2014. All Rights Reserved.
// Node module: loopback-sdk-android
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

var SG = require('strong-globalize');
var g = SG();
var express = require('express');
var remotes = require('strong-remoting').create();
var SharedClass = require('strong-remoting').SharedClass;

remotes.exports = {
  simple: require('./simple'),
  contract: require('./contract'),
};

remotes.addClass(new SharedClass('SimpleClass', require('./simple-class')));
remotes.addClass(new SharedClass('ContractClass', require('./contract-class')));

var app = express();
app.use(require('morgan')('strong-remoting> :method :url :status'));
app.use(remotes.handler('rest'));

var server = require('http')
  .createServer(app)
github strongloop / loopback-connector-remote / lib / remote-connector.js View on Github external
function RemoteConnector(settings) {
  assert(typeof settings ===
    'object',
  'cannot initialize RemoteConnector without a settings object');
  this.client = settings.client;
  this.adapter = settings.adapter || 'rest';
  this.protocol = settings.protocol || 'http';
  this.root = settings.root || '';
  this.host = settings.host || 'localhost';
  this.port = settings.port || 3000;
  this.remotes = remoting.create(settings.options);
  this.name = 'remote-connector';

  if (settings.url) {
    this.url = settings.url;
  } else {
    this.url = this.protocol + '://' + this.host + ':' + this.port + this.root;
  }

  // handle mixins in the define() method
  const DAO = this.DataAccessObject = function() {
  };
}
github strongloop / loopback / lib / application.js View on Github external
app.remotes = function() {
  if (this._remotes) {
    return this._remotes;
  } else {
    let options = {};

    if (this.get) {
      options = this.get('remoting');
    }

    return (this._remotes = RemoteObjects.create(options));
  }
};