LoopBack remote REST API connector
Go to file
Miroslav Bajtoš c724d31f0e 1.3.2
* Update README.md (Rick Blalock)
 * Update URLs in CONTRIBUTING.md (#50) (Ryan Graham)
 * Do not use native promises in tests (Simon Ho)
2016-09-01 09:35:24 +02:00
lib update copyright notices and license 2016-05-06 12:02:21 -07:00
test Do not use native promises in tests 2016-05-19 18:04:23 -07:00
.editorconfig Move remote connector from loopback 2014-09-25 14:20:22 -07:00
.eslintrc Move remote connector from loopback 2014-09-25 14:20:22 -07:00
.gitignore Move remote connector from loopback 2014-09-25 14:20:22 -07:00
.jshintignore Move remote connector from loopback 2014-09-25 14:20:22 -07:00
.jshintrc Clean up tests 2016-01-07 20:08:05 -08:00
.npmignore Move remote connector from loopback 2014-09-25 14:20:22 -07:00
CHANGES.md 1.3.2 2016-09-01 09:35:24 +02:00
CONTRIBUTING.md Update URLs in CONTRIBUTING.md (#50) 2016-07-13 17:33:12 -07:00
Gruntfile.js Do not use native promises in tests 2016-05-19 18:04:23 -07:00
LICENSE update copyright notices and license 2016-05-06 12:02:21 -07:00
README.md Update README.md 2016-08-03 16:20:50 -04:00
index.js update copyright notices and license 2016-05-06 12:02:21 -07:00
package.json 1.3.2 2016-09-01 09:35:24 +02:00

README.md

loopback-connector-remote

Remote REST API connector for loopback-datasource-juggler.

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, {});
	};
	
};