Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 19 additions & 32 deletions docs/site/Best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,25 @@ redirect_from:
summary:
---

{% include important.html content=" The API-first approach for building LoopBack
applications is not yet fully supported. Therefore, some of the sections in this
page are outdated and may not work out of the box. They will be revisited after
our MVP release.
" %}

LoopBack 4 is more than just a framework: It’s an ecosystem that encourages
developers to follow best practices through predefined standards. This section
will walk through some important guidelines by building an example API for a
catalog of products.
developers to follow best practices through predefined standards.

In this section, we provide guidelines on building LoopBack application and
extensions the test-driven way, to make such projects robust and easy to
maintain.

- [**Defining the API using code-first approach**](./Defining-the-API-using-code-first-approach.md):
This section guides you through setting up a skeleton of your application so
that its full OpenAPI specification can be automatically generated.

- [**Defining your testing strategy**](./Defining-your-testing-strategy.md):
This section discusses the advantages and the process of building a strong
testing suite.

Our best practice follows an "API first" and test-driven development approach:
- [**Testing your application**](./Testing-your-application.md): A collection of
practical tips and code snippets useful to developers writing LoopBack
applications.

1. **Defining the API**: There are two possible approaches to take in this
section
- [**Defining the API using code-first approach**](./Defining-the-API-using-code-first-approach.md):
This section guides you through setting up a skeleton of your application
so that its full OpenAPI specification can be automatically generated.
- [**Defining the API using design-first approach**](./Defining-the-API-using-design-first-approach.md):
This section guides you through constructing your API first before any
internal logic is added. **_Not fully supported_**
- [**Testing the API**](./Testing-the-API.md): This section describes the
process of writing smoke test for your API and its spec. **_Not fully
supported_**
2. [**Defining your testing strategy**](./Defining-your-testing-strategy.md):
This section discusses the advantages and the process of building a strong
testing suite.
3. [**Implementing features**](./Implementing-features.md): This section
demonstrates how the tests for each feature of your application should be
written, and how to write the logic to make these tests pass. In the
example, the tests for the controller, model, repository, data source, and
sequence are written and then implemented.
4. [**Preparing the API for consumption**](./Preparing-the-API-for-consumption.md):
This section shows how the endpoints can be physically tested using the
Swagger UI.
- [**Testing your extension**](./Testing-Your-Extensions.md): A collection of
practical tips and code snippets useful to developers building LoopBack
extensions.
3 changes: 0 additions & 3 deletions docs/site/Decorators.md
Original file line number Diff line number Diff line change
Expand Up @@ -602,9 +602,6 @@ The injection example can be found in
To create a repository in a controller, you can define your model and datasource
first, then import them in your controller file:

_To learn more about creating models and datasources, please see the example in
[Best Practices with LoopBack](Implementing-features.md#define-product-model-repository-and-data-source)_

```ts
// src/controllers/todo.controller.ts
import {Todo} from '../models';
Expand Down
6 changes: 0 additions & 6 deletions docs/site/Defining-the-API-using-code-first-approach.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,6 @@ approach, see our
[Todo application](https://github.com/strongloop/loopback-next/blob/master/examples/todo/README.md)
tutorial.

{% include note.html content=" If you would like to create your API manually or
already have one designed, refer to
[Defining the API using design-first approach](Defining-the-API-using-design-first-approach.md)
page for best practices.
" %}

{% include next.html content= "
[Defining your testing strategy](./Defining-your-testing-strategy.md)
" %}
7 changes: 1 addition & 6 deletions docs/site/Defining-your-testing-strategy.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ permalink: /doc/en/lb4/Defining-your-testing-strategy.html
summary:
---

{% include previous.html content=" This article continues
from [Testing the API](./Testing-the-API.md) and
{% include previous.html content=" This article continues from
[Defining the API using code-first approach](./Defining-the-API-using-code-first-approach.md).
" %}

Expand Down Expand Up @@ -130,7 +129,3 @@ To summarize:

See [Testing Your Application](Testing-Your-application.md) for a reference
manual on automated tests.

{% include next.html content= "
[Implementing features](./Implementing-features.md)
" %}
File renamed without changes.
4 changes: 1 addition & 3 deletions docs/site/Testing-your-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ styles work well, so pick one that you're comfortable with and start writing
tests!

For an introduction to automated testing, see
[Define your testing strategy](Defining-your-testing-strategy.md). For a
step-by-step tutorial, see
[Incrementally implement features](Implementing-features.md).
[Define your testing strategy](Defining-your-testing-strategy.md).

{% include important.html content=" A great test suite requires you to think
smaller and favor fast and focused unit tests over slow end-to-end tests.
Expand Down
17 changes: 0 additions & 17 deletions docs/site/sidebars/lb4_sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,27 +152,10 @@ children:
url: Defining-the-API-using-code-first-approach.html
output: 'web, pdf'

- title: 'Defining the API using design-first approach'
url: Defining-the-API-using-design-first-approach.html
output: 'web, pdf'
children:

- title: 'Testing the API'
url: Testing-the-API.html
output: 'web, pdf'

- title: 'Defining your testing strategy'
url: Defining-your-testing-strategy.html
output: 'web, pdf'

- title: 'Implementing features'
url: Implementing-features.html
output: 'web, pdf'

- title: 'Preparing the API for consumption'
url: Preparing-the-API-for-consumption.html
output: 'web, pdf'

- title: 'Testing your application'
url: Testing-your-application.html
output: 'web, pdf'
Expand Down