LoopBack Documentation Hub

repository·gh-pages·Indexed 42 days ago

https://github.com/loopbackio/loopback.io

Community site and documentation hub for the LoopBack framework. Includes guides for the LoopBack 4 Hosted API Explorer, acceptance testing for connectors (MongoDB, MySQL, PostgreSQL, Cloudant, and Fluentd), and experimental modules such as @loopback/rest-msgpack and @loopback/apiconnect.

Tokens
298.9K
Snippets
980
Records
1.3K
Agent score
47%

What's inside LoopBack

  1. Overview of strong-soap features

    gh-pages

    The strong-soap module is a Node.js SOAP implementation based on node-soap that provides the following capabilities:

    • SOAP Client & Server: Full client capability for invoking web services and mock-up server capability for testing.
    • Protocol Support: Handles both RPC and Document styles, as well as SOAP 1.1 and SOAP 1.2 Faults.
    • Data Transformation: APIs to parse XML into JSON and JSON into XML.
    • WSDL Inspection: API to describe WSDL documents.
    • Handler Flexibility: Support for both synchronous and asynchronous method handlers.
    • WS-Security: Supports UsernameToken and PasswordText encoding.
  2. Overview of @loopback/testlab utilities

    gh-pages

    The @loopback/testlab package provides several categories of utilities for testing LoopBack 4 applications:

    • BDD Assertions: Uses expect for readable assertions.
    • Sinon Integration: Provides spies, stubs, and mocks for function manipulation and observation.
    • Supertest Helpers: Helpers for creating supertest clients to test LoopBack applications.
    • HTTP Stubbing: Provides HTTP request/response stubs to allow writing tests without requiring a listening HTTP server.
    • Validation: Includes Swagger/OpenAPI specification validation.
    • Test Sandbox: Provides a managed environment for running tests.
  3. Overview of @loopback/metadata

    gh-pages

    The @loopback/metadata module provides utilities for working with TypeScript decorators, defining and merging metadata, and inspecting metadata applied to classes and their members. It consists of three primary components:

    1. Reflector: A wrapper around reflect-metadata.
    2. Decorator factories: A collection of factories used to create class, method, property, and parameter decorators that apply metadata to static or instance members.
    3. MetadataInspector: High-level APIs designed to inspect classes and their members to retrieve metadata applied via decorators.
  4. Overview of Push Notifications for Android apps

    gh-pages

    To enable an Android application to receive push notifications from a LoopBack server, you must follow these four high-level steps:

    1. Setup Google Play Services: Ensure your app is configured to use Google Play Services.
    2. Device Registration: On app startup, register with GCM (Google Cloud Messaging) servers to obtain a device registration ID (device token), then register that token with your LoopBack server.
    3. Server Configuration: Configure your LoopBack application to receive and process incoming messages from GCM.
    4. Notification Handling: Implement logic within your Android app to process the received notifications.

    Note: The Android SDK may be outdated or lack robustness as it was a former StrongLoop Labs project and is no longer actively maintained by StrongLoop/IBM, though support is available for paying customers via IBM.

  5. Overview of @loopback/rest

    gh-pages

    The @loopback/rest package provides a REST server for LoopBack applications. Key features include:

    • A custom routing engine.
    • Tools for defining application routes.
    • Automatic OpenAPI 3.0 specification generation (openapi.json or openapi.yaml) via @loopback/openapi-v3.
    • A default sequence implementation to manage the request and response lifecycle.

    Note on Sequence Implementation: Starting from version 6.0.0, a middleware-based sequence is introduced and used as the default for new applications generated via the @loopback/cli lb4 command.

  6. Overview of the LoopBack Android SDK

    gh-pages

    The LoopBack Android SDK provides a Java API that allows Android applications to interact with a LoopBack server application. It provides a native way to interact with models and data sources, replacing manual implementations using AsyncHttpClient or JSONObject.

    Note: This SDK is a former StrongLoop Labs project and is no longer actively maintained by IBM/StrongLoop, though support is available for paying customers. It is recommended to use version 1.5 or newer.

  7. Overview of LoopBack Push Notification Component

    gh-pages

    The loopback-component-push module provides a set of LoopBack models designed to enable mobile device push notifications. It supersedes the older loopback-push-notification package.

    Note: This component is for LoopBack 3, which is currently in Maintenance LTS mode. Users are strongly encouraged to migrate to LoopBack 4. Only critical bugs and security fixes are provided for LoopBack 3.

  8. Understand the AngularJS client directory structure

    gh-pages

    The client directory follows this structure:

    • index.html: The main landing page and application entry point.
    • css/: Contains style.css for application styling.
    • js/: Application logic files.
      • app.js: Defines application configuration and states.
      • controllers/: AngularJS controllers (auth.js, review.js).
      • services/: AngularJS services (auth.js, lb-services.js).
    • vendor/: Third-party AngularJS libraries (angular.js, angular-resource.js, angular-ui-router.js).
    • views/: HTML partial templates for different application states (e.g., login.html, all-reviews.html).
  9. Understand the project structure

    gh-pages

    The loopback-example-user-management project follows this layout:

    • common/models: Contains extended user files. user.js handles logic for sending emails and password resets; user.json defines the model.
    • server/boot/authentication.js: Enables authentication middleware via enableAuth(). This middleware extracts the access token from the query string and attaches it to the Express request object as req.accessToken. You can access the user ID via req.accessToken.userId.
    • server/boot/routes.js: Contains all ExpressJS routing logic.
    • server/views: Contains EJS templates for rendering pages.
    • server/datasources.json: Configuration for data sources, including the email datasource.
    • server/model-config.json: Configuration for the extended user model and the email model.
  10. Querying data in LoopBack 4

    gh-pages

    A query is a read operation on models that returns a set of data or results. In LoopBack 4, you can query model instances using either a Node.js API (via Repositories) or a REST API. Both APIs use filters to specify criteria for the returned data set and both return data in JSON format.

    Query Methods Comparison

    Query TaskNode.js Model APIREST API
    Find all instances with filtersfind(filter, options?)GET /modelName?filter...
    Find first instance with filtersfindOne(filter, options?)GET /modelName/findOne?filter...
    Find instance by IDfindById(id, filter?, options?)GET /modelName/modelID
    // Example: Find all instances with a filter
    await accountRepository.find({where: {name: 'John'}});
    
    // Example: Find first instance with a filter
    await accountRepository.findOne({where: {name: 'John'}});
    
    // Example: Find by ID
    await accountRepository.findById('some-id');
  11. Overview of Push Notifications for Android

    gh-pages

    To enable an Android application to receive push notifications from a LoopBack application, you must follow these four high-level steps:

    1. Setup Google Play Services: Ensure your app is configured to use Google Play Services.
    2. Device Registration: On app startup, register with Google Cloud Messaging (GCM) servers to obtain a device registration ID (device token), then register that token with your LoopBack server.
    3. Server Configuration: Configure your LoopBack application to receive and process incoming messages from GCM.
    4. Notification Handling: Implement logic within your Android app to process the received notifications.

    For details on setting up the server-side component, see the Push notifications guide.

  12. What is Booting in LoopBack 4

    gh-pages

    Booting an Application is the process of automatically discovering and binding LoopBack artifacts (such as Controllers, Repositories, and Models) to the Application's Context based on file system conventions.

    LoopBack uses a Bootstrapper that utilizes Booters to scan specific folders for files with certain suffixes and automatically process them. This eliminates the need to manually bind every single class in your application.