Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

loopback-connector-remote

Package Overview
Dependencies
Maintainers
11
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loopback-connector-remote

Remote REST API connector for Loopback

  • 2.0.0-alpha.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14K
decreased by-17.94%
Maintainers
11
Weekly downloads
 
Created
Source

loopback-connector-remote

Remote REST API connector for loopback-datasource-juggler.

  • The version range 2.x is compatible with LoopBack v3 and newer.
  • Use the older range 1.x for applications using LoopBack v2.

Quick Explanation

Use this connector to create a datasource from another Loopback application. Below is a quick example:

datasource.json

	"MyMicroService": {
		"name": "MyMicroService",
		"connector": "remote"
	}

Note that you should add a url property to point to another remote service. If you do not specify a url property, the remote connector will point to it's own host name, port it's running on, etc.

The connector will generate models on the MyMicroService datasource object based on the models/methods exposed from the remote service. Those models will have methods attached that are from the model's remote methods. So if you exposed a remote method from that micro-service called bar from the model foo, the connector will automatically generate the following:

app.datasources.MyMicroService.models.foo.bar()

Access it in any model file

To access the remote Loopback service in a model:

module.exports = function(Message) {

	Message.test = function (cb) {
		Message.app.datasources.MyMicroService.models.SomeModel.remoteMethodNameHere(function () {});

		cb(null, {});
	};

};

Keywords

FAQs

Package last updated on 09 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc