{"id":19874464,"url":"https://github.com/strongloop/loopback-connector-remote","last_synced_at":"2025-07-24T06:07:03.823Z","repository":{"id":20651385,"uuid":"23933452","full_name":"strongloop/loopback-connector-remote","owner":"strongloop","description":"LoopBack remote REST API connector","archived":false,"fork":false,"pushed_at":"2021-03-06T00:59:19.000Z","size":153,"stargazers_count":22,"open_issues_count":1,"forks_count":29,"subscribers_count":48,"default_branch":"master","last_synced_at":"2025-06-23T17:51:19.623Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://loopback.io/doc/en/lb2/Remote-connector.html","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/strongloop.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null}},"created_at":"2014-09-11T19:55:29.000Z","updated_at":"2022-03-03T01:02:12.000Z","dependencies_parsed_at":"2022-08-24T07:30:21.013Z","dependency_job_id":null,"html_url":"https://github.com/strongloop/loopback-connector-remote","commit_stats":null,"previous_names":["kraman/loopback-connector-remotekr"],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/strongloop/loopback-connector-remote","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strongloop%2Floopback-connector-remote","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strongloop%2Floopback-connector-remote/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strongloop%2Floopback-connector-remote/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strongloop%2Floopback-connector-remote/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/strongloop","download_url":"https://codeload.github.com/strongloop/loopback-connector-remote/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strongloop%2Floopback-connector-remote/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266801535,"owners_count":23986372,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T16:23:27.315Z","updated_at":"2025-07-24T06:07:03.792Z","avatar_url":"https://github.com/strongloop.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# loopback-connector-remote\n\n**THIS CONNECTOR DOES NOT SUPPORT LOOPBACK 4**\n\n**⚠️ LoopBack 3 has reached end of life. We are no longer accepting pull requests or providing \nsupport for community users. The only exception is fixes for critical bugs and security \nvulnerabilities provided as part of support for IBM API Connect customers.\nWe urge all LoopBack 3 users to migrate their applications to LoopBack 4 as soon as possible. \nLearn more about\n\u003ca href=\"https://loopback.io/doc/en/contrib/Long-term-support.html\"\u003eLoopBack's long term support policy.\u003c/a\u003e**\n\nThe remote connector enables you to use a LoopBack application as a data source via REST.\nYou can use the remote connector with a LoopBack application, a Node application, or a browser-based application that uses [LoopBack in the client](LoopBack-in-the-client.html).\nThe connector uses [Strong Remoting](Strong-Remoting.html).\n\nIn general, using the remote connector is more convenient than calling into REST API, and enables you to switch the transport later if you need to.\n\nUse loopback-connector-remote:\n\n- Version 3.x with LoopBack v3 and later.\n- Prior versions with LoopBack v2.\n\n## Installation\n\nIn your application root directory, enter:\n\n```shell\n$ npm install loopback-connector-remote --save\n```\n\nThis will install the module and add it as a dependency to the application's [`package.json`](http://loopback.io/doc/en/lb3/package.json.html) file.\n\n## Creating a remote data source\n\nCreate a new remote data source with the [datasource generator](http://loopback.io/doc/en/lb3/Data-source-generator.html):\n\n```shell\n$ lb datasource\n```\n\nWhen prompted:\n\n* For connector, scroll down and select **other**.\n* For connector name without the loopback-connector- prefix, enter **remote**.\n\nThis creates an entry in `datasources.json`; Then you need to edit this to add the data source properties, for example:\n\n{% include code-caption.html content=\"/server/datasources.json\" %}\n```javascript\n...\n \"myRemoteDataSource\": {\n    \"name\": \"myRemoteDataSource\",\n    \"connector\": \"remote\",\n    \"url\": \"http://localhost:3000/api\"\n  }\n ...\n```\n\nThe `url` property specifies the root URL of the LoopBack API.\nIf you do not specify a `url` property, the remote connector will point to it's own host name, port it's running on, etc.\n\nThe connector will generate models on the myRemoteDataSource datasource object based on the models/methods exposed from the remote service.  Those models will have methods attached that are\nfrom the model's remote methods.  So if the model `foo` exposes a remote method called `bar`,\nthe connector will automatically generate the following:\n\n`app.datasources.myRemoteDataSource.models.foo.bar()`\n\n### Access it in any model file\n\nTo access the remote Loopback service in a model:\n\n```javascript\nmodule.exports = function(Message) {\n\n  Message.test = function (cb) {\n    Message.app.datasources.myRemoteDataSource.models.\n      SomeModel.remoteMethodNameHere(function () {});\n\n    cb(null, {});\n  };\n\n};\n```\n\n## Remote data source properties\n\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003cth\u003eProperty\u003c/th\u003e\n      \u003cth width=\"100\"\u003eType\u003c/th\u003e\n      \u003cth\u003eDescription\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003ehost\u003c/td\u003e\n      \u003ctd\u003eString\u003c/td\u003e\n      \u003ctd\u003eHostname of \u003cspan\u003eLoopBack\u003c/span\u003e application \u003cspan\u003eproviding remote data source.\u003c/span\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eport\u003c/td\u003e\n      \u003ctd\u003eNumber\u003c/td\u003e\n      \u003ctd\u003ePort number of \u003cspan\u003eLoopBack\u003c/span\u003e application providing remote \u003cspan\u003edata source\u003c/span\u003e.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eroot\u003c/td\u003e\n      \u003ctd\u003eString\u003c/td\u003e\n      \u003ctd\u003ePath to API root of \u003cspan\u003eLoopBack application providing remote \u003cspan\u003edata source\u003c/span\u003e.\u003c/span\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eurl\u003c/td\u003e\n      \u003ctd\u003eString\u003c/td\u003e\n      \u003ctd\u003eFull URL of \u003cspan\u003eLoopBack application providing remote connector.\n        Use instead of host, port, and root properties.\u003c/span\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n## Configuring authentication\n\nThe remote connector does not support JSON-based configuration of the authentication credentials (see [issue #3](https://github.com/strongloop/loopback-connector-remote/issues/3)).\nYou can use the following code as a workaround. It assumes that your data source is called \"remote\" and the AccessToken id is provided in the variable \"token\".\n\n```javascript\napp.dataSources.remote.connector.remotes.auth = {\n  bearer: new Buffer(token).toString('base64'),\n  sendImmediately: true\n};\n```\n\n## Using with MongoDB connector\n\nWhen using the MongoDB connector on the server and a remote connector on the client,\nuse the following `id` property:\n\n```javascript\n\"id\": {\n  \"type\": \"string\",\n  \"generated\": true,\n  \"id\": true\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrongloop%2Floopback-connector-remote","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstrongloop%2Floopback-connector-remote","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrongloop%2Floopback-connector-remote/lists"}