diff --git a/pages/en/lb2/Connect-your-API-to-a-data-source.md b/pages/en/lb2/Connect-your-API-to-a-data-source.md index bb3b3c3d3..ccb5c659b 100644 --- a/pages/en/lb2/Connect-your-API-to-a-data-source.md +++ b/pages/en/lb2/Connect-your-API-to-a-data-source.md @@ -85,7 +85,7 @@ Now add the loopback-connector-mysql module and install the dependencies: {% include important.html content=" If you have a MySQL database server that you can use, please use it. Create a new database called \"getting_started.\" If you wish, you can use a different database name. Just make sure the `mysqlDs.database` property in `datasources.json `matches it (see below). -If not, you can use the StrongLoop MySQL server running on [demo.strongloop.com](http://demo.strongloop.com/). However, be aware that it is a shared resource. There is a small chance that two users may run the script that creates sample data (see [Add some test data and view it](/doc/en/lb2/Connect-your-API-to-a-data-source.html), below) at the same time and may run into race condition. For this reason, we recommend you use your own MySQL server if you have one." %} +If not, you can use the StrongLoop MySQL server running on [demo.strongloop.com](http://demo.strongloop.com/). However, be aware that it is a shared resource. There is a small chance that two users may run the script that creates sample data (see [Add some test data and view it](#add-some-test-data-and-view-it), below) at the same time and may run into race condition. For this reason, we recommend you use your own MySQL server if you have one." %} Next, you need configure the data source to use the desired MySQL server. diff --git a/pages/en/lb2/Connecting-models-to-data-sources.md b/pages/en/lb2/Connecting-models-to-data-sources.md index 30df58371..497e77e6c 100644 --- a/pages/en/lb2/Connecting-models-to-data-sources.md +++ b/pages/en/lb2/Connecting-models-to-data-sources.md @@ -86,7 +86,7 @@ To connect a model to a data source, follow these steps: $ npm install --save loopback-connector-mysql ``` - See [Connectors](/doc/{{page.lang}}/lb2/Connecting-models-to-data-sources.html) for the list of connectors. + See [Connectors](#connectors) for the list of connectors. 4. Use the [model generator](/doc/{{page.lang}}/lb2/Using-the-model-generator.html) to create a model. diff --git a/pages/en/lb2/Create-AngularJS-client.md b/pages/en/lb2/Create-AngularJS-client.md index 596f1433c..654d9c2ab 100644 --- a/pages/en/lb2/Create-AngularJS-client.md +++ b/pages/en/lb2/Create-AngularJS-client.md @@ -239,7 +239,7 @@ The other lines define application states.  _States_ determine which pages appe The following table summarizes the states, and how the correspond to controllers, templates, and URLs. - +
@@ -570,7 +570,7 @@ Angular _services_ are substitutable objects that you connect  together using  The `js/services` directory contains two AngularJS services libraries: `auth.js` and `lb-services.js`. -You generated the l`b-services.js` previously, and it's described in [Generate lb-services.js](/doc/{{page.lang}}/lb2/Create-AngularJS-client.html).  +You generated the l`b-services.js` previously, and it's described in [Generate lb-services.js](#generate-lb-servicesjs).  The other file, `auth.js`, provides a simple interface for low-level authentication mechanisms.  It uses the `Reviewer` model (that extends the base `User` model) and defines the following services: @@ -630,7 +630,7 @@ angular The `client/views` directory contains seven "partial" view templates loaded by `client/index.html` using the [ngView](https://docs.angularjs.org/api/ngRoute/directive/ngView) directive  A "partial" is a segment of a template in its own HTML file.  -The [table above](/doc/{{page.lang}}/lb2/Create-AngularJS-client.html) describes how the views correspond to states and controllers. +The [table above](#state-summary) describes how the views correspond to states and controllers. ## Run the application diff --git a/pages/en/lb2/Creating-a-database-schema-from-models.md b/pages/en/lb2/Creating-a-database-schema-from-models.md index 55f8de303..122c635f1 100644 --- a/pages/en/lb2/Creating-a-database-schema-from-models.md +++ b/pages/en/lb2/Creating-a-database-schema-from-models.md @@ -17,12 +17,12 @@ Auto-migration creates tables for all models attached to a data source, includin Once you have defined a model, LoopBack can create or update (synchronize) the database schemas accordingly, if you need to adjust the database to match the models. LoopBack provides two ways to synchronize model definitions with table schemas: -* **[Auto-migrate](/doc/{{page.lang}}/lb2/Creating-a-database-schema-from-models.html)**: Automatically create or re-create the table schemas based on the model definitions.  -* **[Auto-update](/doc/{{page.lang}}/lb2/Creating-a-database-schema-from-models.html)**: Automatically alter the table schemas based on the model definitions. +* **[Auto-migrate](#auto-migrate)**: Automatically create or re-create the table schemas based on the model definitions.  +* **[Auto-update](#auto-update)**: Automatically alter the table schemas based on the model definitions. {% include warning.html content=" Auto-migration will drop an existing table if its name matches a model name. -When tables with data exist, use [auto-update](Creating-a-database-schema-from-models.html) to avoid data loss. +When tables with data exist, use [auto-update](#auto-update) to avoid data loss. " %} ## Auto-migrate diff --git a/pages/en/lb2/Defining-boot-scripts.md b/pages/en/lb2/Defining-boot-scripts.md index c24cef4c1..3b38a919f 100644 --- a/pages/en/lb2/Defining-boot-scripts.md +++ b/pages/en/lb2/Defining-boot-scripts.md @@ -55,7 +55,7 @@ Use _boot scripts_ to perform custom initialization in addition to that perfor When an application starts, LoopBack loads all the scripts in the `server/boot` directory. By default, LoopBack loads boot scripts in alphabetical order. You can customize the boot script load order using the options argument of [`boot()`](http://apidocs.strongloop.com/loopback-boot/#boot). -See [Boot script loading order](/doc/{{page.lang}}/lb2/Defining-boot-scripts.html) for details. +See [Boot script loading order](#boot-script-loading-order) for details. ## Predefined boot scripts diff --git a/pages/en/lb2/Defining-middleware.md b/pages/en/lb2/Defining-middleware.md index 3eaeaa6f9..f8d596e93 100644 --- a/pages/en/lb2/Defining-middleware.md +++ b/pages/en/lb2/Defining-middleware.md @@ -23,11 +23,11 @@ Using phases helps to avoid ordering issues that can occur with standard Express LoopBack supports the following types of middleware: -* **Pre-processing middleware** for custom application logic. See [example of static middleware](/doc/{{page.lang}}/lb2/Defining-middleware.html).  +* **Pre-processing middleware** for custom application logic. See [example of static middleware](#static-middleware).  * **Dynamic request handling middleware** to serve dynamically-generated responses, for example HTML pages rendered from templates and JSON responses to REST API requests. - See [example of pre-processing middleware](/doc/{{page.lang}}/lb2/Defining-middleware.html). -* **Static middleware** to serve static client-side assets.  See [example of static middleware](/doc/{{page.lang}}/lb2/Defining-middleware.html). -* **Error-handling middleware** to deal with request errors. See [example of error-handling middleware](/doc/{{page.lang}}/lb2/Defining-middleware.html). + See [example of pre-processing middleware](#pre-processing-middleware). +* **Static middleware** to serve static client-side assets.  See [example of static middleware](#static-middleware). +* **Error-handling middleware** to deal with request errors. See [example of error-handling middleware](#error-handling-middleware). ### How to add middleware @@ -35,17 +35,17 @@ To add middleware to your application: 1. **Specify the middleware function**: 1. If using an existing function or package, add the code to your application or install the package.  - 2. If you are creating a new middleware function, write it. See [Defining a new middleware handler function](/doc/{{page.lang}}/lb2/Defining-middleware.html). + 2. If you are creating a new middleware function, write it. See [Defining a new middleware handler function](#defining-a-new-middleware-handler-function). 2. **Register the middleware**: - * Edit `server/middleware.json`. This is the recommended way to register middleware. See [Registering middleware in middleware.json](/doc/{{page.lang}}/lb2/Defining-middleware.html). - * Alternatively, register the middleware in application code. See [Registering middleware in JavaScript](/doc/{{page.lang}}/lb2/Defining-middleware.html). + * Edit `server/middleware.json`. This is the recommended way to register middleware. See [Registering middleware in middleware.json](#registering-middleware-in-middlewarejson). + * Alternatively, register the middleware in application code. See [Registering middleware in JavaScript](#registering-middleware-in-javascript). ### Middleware phases LoopBack defines a number of _phases_, corresponding to different aspects of application execution. When you register middleware, you can specify the phase in which the application will call it. -See [Registering middleware in middleware.json](/doc/{{page.lang}}/lb2/Defining-middleware.html) and [Using the LoopBack API](/doc/{{page.lang}}/lb2/Defining-middleware.html). +See [Registering middleware in middleware.json](#registering-middleware-in-middlewarejson) and [Using the LoopBack API](#using-the-loopback-api). If you register middleware (or routes) with the Express API, then it is executed at the beginning of the `routes` phase. The predefined phases are: @@ -79,7 +79,7 @@ Always explicitly order the middleware using appropriate phases when order matte LoopBack provides convenience middleware for commonly-used Express/Connect middleware, as described in the following table. When you use this middleware, you don't have to write any code or install any packages; you just specify in which phase you want it to be called. -See [Registering middleware in middleware.json](/doc/{{page.lang}}/lb2/Defining-middleware.html). +See [Registering middleware in middleware.json](#registering-middleware-in-middlewarejson).
State
@@ -193,12 +193,11 @@ Best practice is to load this middleware directly via `require()` and not rely
-   -

-
-

Using other middleware

+ +### Using other middleware + You can use any middleware compatible with Express; see [Express documentation](http://expressjs.com/resources/middleware.html) for a partial list. Simply install it: @@ -208,9 +207,9 @@ $ npm install --save ``` Then simply register it so that it is called as needed. -See [Registering middleware in middleware.json](/doc/{{page.lang}}/lb2/Defining-middleware.html)  +See [Registering middleware in middleware.json](#registering-middleware-in-middlewarejson)  and -[Registering middleware in JavaScript](/doc/{{page.lang}}/lb2/Defining-middleware.html). +[Registering middleware in JavaScript](#registering-middleware-in-javascript). ### Defining a new middleware handler function @@ -317,7 +316,7 @@ module.exports = function(options) { }; ``` -For details about the `options` object, refer to [Middleware configuration properties](/doc/{{page.lang}}/lb2/Defining-middleware.html). +For details about the `options` object, refer to [Middleware configuration properties](#middleware-configuration-properties). ## Registering middleware in middleware.json @@ -373,11 +372,11 @@ phase[:sub-phase] : { Where: -* _phase_:  is one of the predefined phases listed above (initial, session, auth, and so on) or a custom phase; see [Adding a custom phase](/doc/{{page.lang}}/lb2/Defining-middleware.html). +* _phase_:  is one of the predefined phases listed above (initial, session, auth, and so on) or a custom phase; see [Adding a custom phase](#adding-a-custom-phase). * _sub-phase_:  (optional) can be `before` or `after`. -* _name_: optional middleware name. See [Middleware configuration properties](/doc/{{page.lang}}/lb2/Defining-middleware.html) below. -* _middlewarePath_: path to the middleware function. See [Path to middleware function](/doc/{{page.lang}}/lb2/Defining-middleware.html) below. -* _paramSpec_:  value of the middleware parameters, typically a JSON object. See [Middleware configuration properties](/doc/{{page.lang}}/lb2/Defining-middleware.html) below. +* _name_: optional middleware name. See [Middleware configuration properties](#middleware-configuration-properties) below. +* _middlewarePath_: path to the middleware function. See [Path to middleware function](#path-to-middleware-function) below. +* _paramSpec_:  value of the middleware parameters, typically a JSON object. See [Middleware configuration properties](#middleware-configuration-properties) below. * _methodSpec_: HTTP methods, such as 'GET', 'POST', and 'PUT'. If not present, applies to all methods. * _routeSpec_:  REST endpoint(s) that trigger the middleware. @@ -386,7 +385,7 @@ Where: Specify the path to the middleware function (_middlewarePath)_ in the following ways: * For an external middleware module installed in the project, just use the name of the module; for example `compression`. - See [Using other middleware](/doc/{{page.lang}}/lb2/Defining-middleware.html). + See [Using other middleware](#using-other-middleware). * For a script in a module installed in the project, use the path to the module; for example `loopback/server/middleware/rest`. * For a script with a custom middleware function, use the path relative to `middleware.json`, for example `./middleware/custom`. * Absolute path to the script file (not recommended). @@ -626,9 +625,9 @@ The parameters are: 1. _`route`_, an optional parameter that specifies the URI route or "mount path" to which the middleware is bound. When the application receives an HTTP request at this route, it calls (or _triggers_) the handler function. - See [Specifying routes](/doc/{{page.lang}}/lb2/Defining-middleware.html). + See [Specifying routes](#specifying-routes). 2. The middleware handler function (or just "middleware function"). - See [Defining a new middleware handler function](/doc/{{page.lang}}/lb2/Defining-middleware.html). + See [Defining a new middleware handler function](#defining-a-new-middleware-handler-function). For example: @@ -840,4 +839,4 @@ To register this middleware: ``` 3. Start the application. -4. Load [http://localhost:3000/url-does-not-exist](http://localhost:3000/url-does-not-exist) in your browser. \ No newline at end of file +4. Load [http://localhost:3000/url-does-not-exist](http://localhost:3000/url-does-not-exist) in your browser. diff --git a/pages/en/lb2/Embedded-models-and-relations.md b/pages/en/lb2/Embedded-models-and-relations.md index 74d15a34f..394ec5cbd 100644 --- a/pages/en/lb2/Embedded-models-and-relations.md +++ b/pages/en/lb2/Embedded-models-and-relations.md @@ -14,11 +14,11 @@ summary: LoopBack relations enable you to create connections between models and provide navigation/aggregation APIs to deal with a graph of model instances. In addition to the traditional ones, LoopBack also supports the following embedded relations: -* [EmbedsOne](/doc/{{page.lang}}/lb2/Embedded-models-and-relations.html) - a model that embeds another model; for example, a Customer embeds one billingAddress. -* [EmbedsMany](/doc/{{page.lang}}/lb2/Embedded-models-and-relations.html) - a model that embeds many instances of another model. +* [EmbedsOne](#embedsone) - a model that embeds another model; for example, a Customer embeds one billingAddress. +* [EmbedsMany](#embedsmany) - a model that embeds many instances of another model. For example, a Customer can have multiple email addresses and each email address is a complex object that contains label and address.. -* [EmbedsMany with belongsTo](/doc/{{page.lang}}/lb2/Embedded-models-and-relations.html) - a model that embeds many links to related people, such as an author or a reader.  -* [ReferencesMany](/doc/{{page.lang}}/lb2/Embedded-models-and-relations.html) +* [EmbedsMany with belongsTo](#embedsmany-with-belongsto) - a model that embeds many links to related people, such as an author or a reader.  +* [ReferencesMany](#referencesmany) {% include important.html content=" diff --git a/pages/en/lb2/Installing-compiler-tools.md b/pages/en/lb2/Installing-compiler-tools.md index 17e3f081d..ab8d79b4b 100644 --- a/pages/en/lb2/Installing-compiler-tools.md +++ b/pages/en/lb2/Installing-compiler-tools.md @@ -111,7 +111,7 @@ Enter the following command to validate your Xcode license, then reinstall Stron Many Linux systems come with the necessary tools.   The specific requirements are: -* Python (v2.7 recommended; v3.x.x is **_not_** supported).  If you installed Python in a non-standard location, see [Configuring Python directory](/doc/{{page.lang}}/lb2/Installing-compiler-tools.html). +* Python (v2.7 recommended; v3.x.x is **_not_** supported).  If you installed Python in a non-standard location, see [Configuring Python directory](#configuring-python-directory). * `make` * A proper C/C-- compiler toolchain, like GCC.  **NOTE**: g-- version 4.2 or later is required. diff --git a/pages/en/lb2/Memory-connector.md b/pages/en/lb2/Memory-connector.md index ba86425db..c8addaacc 100644 --- a/pages/en/lb2/Memory-connector.md +++ b/pages/en/lb2/Memory-connector.md @@ -23,7 +23,7 @@ The memory connector supports: {% include important.html content=" The memory connector is designed for development and testing of a single-process application without setting up a database. It cannot be used in a cluster as the worker processes will have their own isolated data not shared in the cluster. -You can persist data between application restarts using the `file` property. See [Data persistence](Memory-connector.html) for more information. +You can persist data between application restarts using the `file` property. See [Data persistence](#data-persistence) for more information. " %} ## Creating a data source diff --git a/pages/en/lb2/Model-definition-JSON-file.md b/pages/en/lb2/Model-definition-JSON-file.md index d13125ead..ff9dc1780 100644 --- a/pages/en/lb2/Model-definition-JSON-file.md +++ b/pages/en/lb2/Model-definition-JSON-file.md @@ -930,7 +930,7 @@ Product.find({order: "name", offset: 0, limit: 100, where: {deleted: false}}, cb ### Default scopes with where filters -Adding a `scope` to a model definition (in the [`model.json` file](/doc/{{page.lang}}/lb2/Model-definition-JSON-file.html)) automatically adds a method to model called `defaultScope()`. +Adding a `scope` to a model definition (in the model.json file) automatically adds a method to model called `defaultScope()`. LoopBack will call this method whenever a model is created, updated, or queried. {% include tip.html content="Default scopes with a `where` filter may not work as you expect!" %} diff --git a/pages/en/lb2/Operation-hooks.md b/pages/en/lb2/Operation-hooks.md index 49e0dfa1f..2139e4c7e 100644 --- a/pages/en/lb2/Operation-hooks.md +++ b/pages/en/lb2/Operation-hooks.md @@ -231,7 +231,7 @@ See the documentation of individual hooks for more information. {% include important.html content=" Only certain connectors support `ctx.isNewInstance`. With other connectors it is undefined. -See [Checking for support of ctx.isNewInstance](Operation-hooks.html)." %} +See [Checking for support of ctx.isNewInstance](#checking-for-support-ofctxisnewinstance)." %} ##### currentInstance @@ -475,7 +475,7 @@ Depending on which method triggered this hook, the context will have one of the * `Model` - the constructor of the model that will be saved * `where` - the where filter describing which instances will be affected * `data` - the (partial) data to apply during the update - * `currentInstance` - the instance being affected, see [Triggering with prototype.updateAttributes](/doc/{{page.lang}}/lb2/Operation-hooks.html) below. + * `currentInstance` - the instance being affected, see [Triggering with prototype.updateAttributes](#triggering-with-prototypeupdateattributes) below. #### ctx.isNewInstance diff --git a/pages/en/lb2/Push-notifications-for-Android-apps.md b/pages/en/lb2/Push-notifications-for-Android-apps.md index 5b9c560c1..17cfca70f 100644 --- a/pages/en/lb2/Push-notifications-for-Android-apps.md +++ b/pages/en/lb2/Push-notifications-for-Android-apps.md @@ -138,7 +138,7 @@ Then follow these steps to run the app: 5. Edit `src/com/google/android/gcm/demo/app/DemoActivity.java`.  * Set SENDER_ID to the project number from the Google Developers Console you created earlier in  - [Get your Google Cloud Messaging credentials](/doc/{{page.lang}}/lb2/Push-notifications-for-Android-apps.html). + [Get your Google Cloud Messaging credentials](#get-your-google-cloud-messaging-credentials). 6. Go back to the [https://cloud.google.com/console/project](https://cloud.google.com/console/project) and edit the Android Key to reflect your unique application ID. Set the value of **Android applications** to something like this: @@ -205,7 +205,7 @@ Add the following key and value to the push settings of your application: } ``` -Replace `server-api-key` with the API key you obtained in [Get your Google Cloud Messaging credentials](/doc/{{page.lang}}/lb2/Push-notifications-for-Android-apps.html). +Replace `server-api-key` with the API key you obtained in [Get your Google Cloud Messaging credentials](#get-your-google-cloud-messaging-credentials). ## Prepare your own Android project @@ -368,4 +368,4 @@ When running your app in the Eclipse device emulator, you may encounter the foll `Google Play services, which some of your applications rely on, is not supported by your device. Please contact the manufacturer for assistance.` To resolve this, install a compatible version of the Google APIs platform. -See [Prepare your Android project](/doc/{{page.lang}}/lb2/Push-notifications-for-Android-apps.html) for more information. \ No newline at end of file +See [Prepare your Android project](#prepare-your-own-android-project) for more information. diff --git a/pages/en/lb2/Push-notifications.md b/pages/en/lb2/Push-notifications.md index f9d9614b9..ecdb2549e 100644 --- a/pages/en/lb2/Push-notifications.md +++ b/pages/en/lb2/Push-notifications.md @@ -35,7 +35,7 @@ The following diagram illustrates how it works. To send push notifications, you'll need to create a LoopBack server application, then configure your iOS and Android client apps accordingly. You can either use the example LoopBack push application or create your own. Using the example application is a good way to learn about LoopBack push notifications.  -For more information on the architecture of the LoopBack Push Notification component, see [Architecture](/doc/{{page.lang}}/lb2/Push-notifications.html) below. +For more information on the architecture of the LoopBack Push Notification component, see [Architecture](#architecture) below. {% include tip.html content=" For information on how to implement real-time \"push-like\" notifications to web clients, see [Realtime server-sent events](Realtime-server-sent-events.html)." %} @@ -51,7 +51,7 @@ $ npm install loopback-component-push ## Use the LoopBack push notification sample application {% include important.html content=" -If you are creating your own LoopBack server application, skip this section and go to [Set up your LoopBack application to send push notifications](Push-notifications.html)." %} +If you are creating your own LoopBack server application, skip this section and go to [Set up your LoopBack application to send push notifications](#set-up-your-loopback-application-to-send-push-notifications)." %} First, download the sample app: @@ -162,7 +162,7 @@ Use the Application model's [`register()`](http://apidocs.strongloop.com/loop For information on getting API keys, see: * [Get your Google Cloud Messaging credentials](/doc/{{page.lang}}/lb2/Push-notifications-for-Android-apps) for Android. -* [Set up iOS clients](/doc/{{page.lang}}/lb2/Push-notifications.html) for iOS. +* [Set up iOS clients](#set-up-messaging-credentials-for-ios-apps) for iOS. For example, here is how the sample app registers a mobile client: diff --git a/pages/en/lb2/Querying-data.md b/pages/en/lb2/Querying-data.md index 6c1007fea..4b4a18e10 100644 --- a/pages/en/lb2/Querying-data.md +++ b/pages/en/lb2/Querying-data.md @@ -84,11 +84,11 @@ A REST query must include the literal string \"filter\" in the URL query string. The Node API call does not include the literal string \"filter\" in the JSON. [LoopBack API Explorer](Use-API-Explorer.html) adds \"filter\" to the query string, -but you must enter [Stringified JSON](Querying-data.html) in the **filter** field. +but you must enter [Stringified JSON](#using-stringified-json-in-rest-queries) in the **filter** field. Also make sure that the quotes you use are proper straight quotes ( \" ), not curved or typographic quotation marks ( “ or ” ). These can often be hard to distinguish visually." %} {% include tip.html content=" -If you are trying [query filters](Querying-data.html) with curl, use the `-g` or `--globoff`  option to use brackets `[` and `]` in request URLs." %} +If you are trying [query filters](#filters) with curl, use the `-g` or `--globoff`  option to use brackets `[` and `]` in request URLs." %} LoopBack supports the following kinds of filters: @@ -99,7 +99,7 @@ LoopBack supports the following kinds of filters: * [Skip filter](/doc/{{page.lang}}/lb2/Skip-filter.html) * [Where filter](/doc/{{page.lang}}/lb2/Where-filter.html) -See [Filters](/doc/{{page.lang}}/lb2/Querying-data.html) below for more information. +See [Filters](#filters) below for more information. ### Examples diff --git a/pages/en/lb2/REST-connector.md b/pages/en/lb2/REST-connector.md index 64825b688..992c6ac79 100644 --- a/pages/en/lb2/REST-connector.md +++ b/pages/en/lb2/REST-connector.md @@ -19,8 +19,8 @@ summary: The LoopBack REST connector enables applications to interact with other (third party) REST APIs using a template-driven approach. It supports two different styles of API invocations: -* [Resource operations](/doc/{{page.lang}}/lb2/REST-connector.html) -* [Defining a custom method using a template](/doc/{{page.lang}}/lb2/REST-connector.html) +* [Resource operations](#resource-operations) +* [Defining a custom method using a template](#defining-a-custom-method-using-a-template) ## Installation @@ -91,7 +91,7 @@ Configure the REST connector by editing `datasources.json` manually (for examp For a REST data source, you can define an array of  _operation_ objects to specify the REST API mapping. Each operation object can have the following two properties: -* template: See how to define a custom method template [below](/doc/{{page.lang}}/lb2/REST-connector.html). +* template: See how to define a custom method template [below](#defining-a-custom-method-using-a-template). * functions: An object that maps a JavaScript function to a list of parameter names. For example, a function geocode(street, city, zipcode) will be created so that the first argument will be the value of street variable in the template, second for city, and third for zipcode.  The function can be executed anywhere by the server (in a boot script, through middleware, or within a model's .js file if it is attached to the REST datasource).  diff --git a/pages/en/lb2/Remote-hooks.md b/pages/en/lb2/Remote-hooks.md index eb3077967..a772e46ff 100644 --- a/pages/en/lb2/Remote-hooks.md +++ b/pages/en/lb2/Remote-hooks.md @@ -81,7 +81,7 @@ Where: * `_methodName_` is the name of the method that triggers the remote hook. This may be a custom [remote method](/doc/{{page.lang}}/lb2/Remote-methods.html) or a standard create, retrieve, update, and delete method inherited from [PersistedModel](http://apidocs.strongloop.com/loopback/#persistedmodel). It may include wildcards to match more than one method (see below). -* `ctx` is the [context object](/doc/{{page.lang}}/lb2/Remote-hooks.html).  +* `ctx` is the [context object](#context-object).  * `_modelInstance_` is the affected model instance. The syntax above includes a call to `next()` as a reminder that you must call `next()` at some point in the remote hook callback function. diff --git a/pages/en/lb2/Synchronization.md b/pages/en/lb2/Synchronization.md index 2e2222ed5..61af8deb2 100644 --- a/pages/en/lb2/Synchronization.md +++ b/pages/en/lb2/Synchronization.md @@ -42,7 +42,7 @@ In general there may be conflicts when performing replication. So, for example, while disconnected, a user may make changes on the client that conflict with changes made on the server. What happens when an object or field is modified both locally and remotely? LoopBack handles conflict resolution for you, and enables you to easily present a user interface to allow the end user to make informed decisions to resolve conflicts when they occur. -See [Resolving conflicts](/doc/{{page.lang}}/lb2/Synchronization.html) below. +See [Resolving conflicts](#conflict-resolution) below. {% include note.html content=" Currently synchronization is built-in to LoopBack, but will be refactored into a component in the future. diff --git a/pages/en/lb2/Use-API-Explorer.md b/pages/en/lb2/Use-API-Explorer.md index 60839f8a9..d834964a4 100644 --- a/pages/en/lb2/Use-API-Explorer.md +++ b/pages/en/lb2/Use-API-Explorer.md @@ -86,7 +86,7 @@ using the **filter** field to specify a [Where filter](/doc/{{page.lang}}/lb2 [Limit filter](/doc/{{page.lang}}/lb2/Limit-filter), and other kinds of filters on the query.  See [Querying data](/doc/{{page.lang}}/lb2/Querying-data) for more information. -API Explorer automatically adds \"filter\" to the query string, but you must enter [Stringified JSON](/doc/{{page.lang}}/lb2/Use-API-Explorer.html) in the **filter** field. Also make sure that the quotes you use are proper straight quotes ( \" ), not curved or typographic quotation marks ( “ or ” ). These can often be hard to distinguish visually. +API Explorer automatically adds \"filter\" to the query string, but you must enter [Stringified JSON](/doc/{{page.lang}}/lb2/Querying-data#using-stringified-json-in-rest-queries) in the **filter** field. Also make sure that the quotes you use are proper straight quotes ( \" ), not curved or typographic quotation marks ( “ or ” ). These can often be hard to distinguish visually. You may have noticed the **accessToken** field and **Set Access Token** button at the top right of the API Explorer window. Use these to authenticate a user and "login" to an app so you can perform actions that require authentication. For more information, see [Introduction to User model authentication](/doc/{{page.lang}}/lb2/Introduction-to-User-model-authentication). diff --git a/pages/en/lb2/Using-LoopBack-with-IBM-API-Connect.md b/pages/en/lb2/Using-LoopBack-with-IBM-API-Connect.md index 23140d81d..912112e91 100644 --- a/pages/en/lb2/Using-LoopBack-with-IBM-API-Connect.md +++ b/pages/en/lb2/Using-LoopBack-with-IBM-API-Connect.md @@ -53,7 +53,7 @@ and perform other actions provided by data sources and services. Clients can call LoopBack APIs directly using [Strong Remoting](/doc/{{page.lang}}/lb2/Strong-Remoting.html), a pluggable transport layer that enables you to provide backend APIs over REST, WebSockets, and other transports. -The following diagram illustrates key [LoopBack modules](/doc/{{page.lang}}/lb2/Using-LoopBack-with-IBM-API-Connect.html), how they are related, and their dependencies. +The following diagram illustrates key [LoopBack modules](#loopback-framework-modules), how they are related, and their dependencies. {% include image.html file="9830413.png" alt="" %} @@ -184,4 +184,4 @@ The following diagram illustrates key [LoopBack modules](/doc/{{page.lang}}/lb2/ - \ No newline at end of file + diff --git a/pages/en/lb2/Using-built-in-models.md b/pages/en/lb2/Using-built-in-models.md index c422ca380..d1360ff4a 100644 --- a/pages/en/lb2/Using-built-in-models.md +++ b/pages/en/lb2/Using-built-in-models.md @@ -13,10 +13,10 @@ summary: Loopback provides useful built-in models for common use cases: -* **[Application model](/doc/{{page.lang}}/lb2/Using-built-in-models.html)** - contains metadata for a client application that has its own identity and associated configuration with the LoopBack server. -* **[User model](/doc/{{page.lang}}/lb2/Using-built-in-models.html)** - register and authenticate users of your app locally or against third-party services. -* **[Access control models](/doc/{{page.lang}}/lb2/Using-built-in-models.html)** - ACL, AccessToken, Scope, Role, and RoleMapping models for controlling access to applications, resources, and methods. -* **[Email model](/doc/{{page.lang}}/lb2/Using-built-in-models.html)** - send emails to your app users using SMTP or third-party services. +* **[Application model](#application-model)** - contains metadata for a client application that has its own identity and associated configuration with the LoopBack server. +* **[User model](#user-model)** - register and authenticate users of your app locally or against third-party services. +* **[Access control models](#access-control-models)** - ACL, AccessToken, Scope, Role, and RoleMapping models for controlling access to applications, resources, and methods. +* **[Email model](#email-model)** - send emails to your app users using SMTP or third-party services. The built-in models (except for Email) extend [PersistedModel](http://apidocs.strongloop.com/loopback/#persistedmodel), so they automatically have a full complement of create, update, and delete (CRUD) operations. diff --git a/pages/en/lb2/Where-filter.md b/pages/en/lb2/Where-filter.md index ed5c3dcc7..9834aef4e 100644 --- a/pages/en/lb2/Where-filter.md +++ b/pages/en/lb2/Where-filter.md @@ -51,7 +51,7 @@ Where: * _property_ is the name of a property (field) in the model being queried. * _value_ is a literal value.  -* _op_ is one of the [operators](/doc/{{page.lang}}/lb2/Where-filter.html) listed below. +* _op_ is one of the [operators](#operators) listed below. ```javascript Cars.find({where: {carClass:'fullsize'}}); @@ -63,7 +63,7 @@ The equivalent REST query would be: {% include tip.html content=" The above where clause syntax is for queries, and not for [`count()`](http://apidocs.strongloop.com/loopback/#persistedmodel-count). -For all other methods, including `count()`, omit the `{ where : ... }` wrapper; see [Where clause for other methods](Where-filter.html) below." %} +For all other methods, including `count()`, omit the `{ where : ... }` wrapper; see [Where clause for other methods](#where-clause-for-other-methods) below." %} ### Where clause for other methods @@ -86,7 +86,7 @@ Where: * _property_ is the name of a property (field) in the model being queried. * _value_ is a literal value.  -* _op_ is one of the [operators](/doc/{{page.lang}}/lb2/Where-filter.html) listed below. +* _op_ is one of the [operators](#operators) listed below. For example, below shows a where clause in a call to a model's [updateAll()](http://apidocs.strongloop.com/loopback/#persistedmodel-updateall) method. Note the lack of `{ where : ... }` in the argument. @@ -139,7 +139,7 @@ var defaultScope = Report.defaultScope; ## Operators -This table describes the operators available in "where" filters. See [Examples](/doc/{{page.lang}}/lb2/Where-filter.html) below. +This table describes the operators available in "where" filters. See [Examples](#examples) below. @@ -217,7 +217,7 @@ Use the AND and OR operators to create compound logical filters based on simple Where _condition1_ and _condition2_ are a filter conditions. -See [examples](/doc/{{page.lang}}/lb2/Where-filter.html) below. +See [examples](#examples) below. ### Regular expressions @@ -257,7 +257,7 @@ see [Regular Expressions (Mozilla Developer Network)](https://developer.mozilla {% include tip.html content=" The above where clause syntax is for queries. For updates and deletes, omit the `{ where : ... }` wrapper. -See [Where clause for other methods](Where-filter.html) below." %} +See [Where clause for other methods](#where-clause-for-other-methods) below." %} For example, this query returns all cars for which the model starts with a capital "T": diff --git a/pages/en/lb2/Working-with-LoopBack-objects.md b/pages/en/lb2/Working-with-LoopBack-objects.md index 2811c1578..28562ca3e 100644 --- a/pages/en/lb2/Working-with-LoopBack-objects.md +++ b/pages/en/lb2/Working-with-LoopBack-objects.md @@ -107,7 +107,7 @@ module.exports = function(Book) { ``` {% include tip.html content=" -This technique is useful to get a reference to an unrelated model; see [Getting a reference to an unrelated model](Working-with-LoopBack-objects.html) below." %} +This technique is useful to get a reference to an unrelated model; see [Getting a reference to an unrelated model](#getting-a-reference-to-an-unrelated-model) below." %} With models, there is a special case. From anywhere except `/common/models/model.js`, you can actually get a reference to `app` through a model using `model.app`.