Translation last updated: 17 Nov 2015.
This documentation is for LoopBack 2.x.
For the latest information, see the LoopBack documentation in English.
Skip to end of metadata
Go to start of metadata

Overview

LoopBack components are predefined packages that extend a basic LoopBack application.  Fundamentally, a component is related code bundled together as a unit to enable LoopBack applications for easy reuse.  You can configure components declaratively in component-config.json.

The bare minimum to meet the LoopBack component "contract" is to export a function(app, options) as the main module export.

A LoopBack application itself is nothing more than a grouping of components with elements to tie them all together.

Component contract

To be a LoopBack component, a module must export a function with the following signature as the main module export:

function(app, options)
Compare that with Express middleware, which exports function(options) that is supposed to return function(req, res, next) or function(err, req, res, next).
REVIEW COMMENT from Rand
Take a look at the changes made to the module: https://github.com/strongloop/loopback-component-explorer/pull/104.

Pre-defined LoopBack components

LoopBack provides several pre-defined components, as described in the table below.

The sections below describe the configuration settings for each component in component-config.json.

Component

Description

Module

API ExplorerEnables the Swagger UI for the API. See Use API Explorer for an example.loopback-component-explorer
OAuth 2.0Enables LoopBack applications to function as oAuth 2.0 providers to authenticate and authorize client applications and users to access protected API endpoints.loopback-component-oauth2
Adds push notification capabilities to your LoopBack application as a mobile back end service.
Storage componentAdds an interface to abstract storage providers like S3, filesystem into general containers and files.loopback-component-storage
SynchronizationAdds replication capability between LoopBack running in a browser or between LoopBack back-end instances to enable offline synchronization and server-to-server data synchronization.

Built into LoopBack; will be refactored into loopback-component-sync

Third-party login (Passport)Adds third-party login capabilities to your LoopBack application like Facebook, GitHub etc.loopback-component-passport

API Explorer

The slc loopback application generator will scaffold an app with component-config.json containing the default entry for LoopBack API Explorer: 

server/component-config.json

OAuth2

Example:

server/component-config.json

Push Notifications

Icon

This component does not yet meet the "contract" to be a LoopBack component.

Non-public Information
server/component-config.json
PropertyDescription
gcmServerApiKeyFor Android apps, Google Cloud Messaging (GCM) API key.
apnsCertDataFor iOS apps, Apple Push Notification Service (APNS) certificate name and location
apnsKeyDataFor iOS apps, Apple Push Notification Service (APNS) key file name and location

Storage

Icon

This component does not yet meet the "contract" to be a LoopBack component.

Non-public Information
server/component-config.json

ProviderPropertyDescriptionExample

Amazon

 

provider: 'amazon' 
key

Amazon key
keyIdAmazon key ID

Rackspace

provider: 'rackspace'

 
usernameYour username
apiKeyYour API key
Azure

provider: 'azure'

 
storageAccountName of your storage account
storageAccessKeyAccess key for storage account
OpenStackprovider: 'openstack' 
usernameYour username
passwordYour password
authUrlYour identity service
Local File Systemprovider: 'filesystem' 
rootFile path to storage root directory.

Third-party login (Passport)

Non-public Information
server/component-config.json

Icon

This component does not yet meet the "contract" to be a LoopBack component.

  • No labels