Skip to content

Commit f496919

Browse files
committed
docs: migrate missing files from loopback.io
1 parent eb09a44 commit f496919

21 files changed

+1203
-249
lines changed

docs/lb4_sidebar.yml

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
## definition of `menuitem`===========
2+
# title: string
3+
# url: string
4+
# output: [ enum{web, pdf} ] (expressed as comma separated string in YAML)
5+
# children?: [ menuitem ]
6+
7+
## top level property=================
8+
# entries: [ menuitem ]
9+
10+
title: LoopBack 4
11+
url: index.html
12+
children:
13+
14+
- title: 'Getting started'
15+
url: Getting-started.html
16+
output: 'web, pdf'
17+
children:
18+
19+
- title: 'Examples and tutorials'
20+
url: Examples-and-tutorials.html
21+
output: 'web, pdf'
22+
23+
- title: 'Key concepts'
24+
url: Concepts.html
25+
output: 'web, pdf'
26+
children:
27+
28+
- title: 'Application'
29+
url: Application.html
30+
output: 'web, pdf'
31+
32+
- title: 'Server'
33+
url: Server.html
34+
output: 'web, pdf'
35+
36+
- title: 'Context'
37+
url: Context.html
38+
output: 'web, pdf'
39+
40+
- title: 'Dependency injection'
41+
url: Dependency-injection.html
42+
output: 'web, pdf'
43+
44+
- title: 'Controllers'
45+
url: Controllers.html
46+
output: 'web, pdf'
47+
48+
- title: 'Routes'
49+
url: Routes.html
50+
output: 'web, pdf'
51+
52+
- title: 'Sequence'
53+
url: Sequence.html
54+
output: 'web, pdf'
55+
56+
- title: 'Model'
57+
url: Model.html
58+
output: 'web, pdf'
59+
60+
- title: 'Repositories'
61+
url: Repositories.html
62+
output: 'web, pdf'
63+
64+
- title: 'Decorators'
65+
url: Decorators.html
66+
output: 'web, pdf'
67+
68+
- title: 'Booting an Application'
69+
url: Booting-an-Application.html
70+
output: 'web, pdf'
71+
72+
- title: 'Using Components'
73+
url: Using-components.html
74+
output: 'web, pdf'
75+
76+
- title: 'Calling other APIs'
77+
url: Calling-other-APIs-and-web-services.html
78+
output: 'web, pdf'
79+
80+
- title: 'Testing your application'
81+
url: Testing-your-application.html
82+
output: 'web, pdf'
83+
84+
- title: 'For current LoopBack users'
85+
url: LoopBack-3.x.html
86+
output: 'web, pdf'
87+
88+
- title: 'Command-line interface'
89+
url: Command-line-interface.html
90+
output: 'web, pdf'
91+
children:
92+
93+
- title: 'Application generator'
94+
url: Application-generator.html
95+
output: 'web, pdf'
96+
97+
- title: 'Controller generator'
98+
url: Controller-generator.html
99+
output: 'web, pdf'
100+
101+
- title: 'Extension generator'
102+
url: Extension-generator.html
103+
output: 'web, pdf'
104+
105+
- title: 'Download examples'
106+
url: Download-examples.html
107+
output: 'web, pdf'
108+
109+
- title: 'Best practices with Loopback 4'
110+
url: Best-practices-with-Loopback-4.html
111+
output: 'web, pdf'
112+
children:
113+
114+
- title: 'Defining the API using code-first approach'
115+
url: Defining-the-API-using-code-first-approach.html
116+
output: 'web, pdf'
117+
118+
- title: 'Defining the API using design-first approach'
119+
url: Defining-the-API-using-design-first-approach.html
120+
output: 'web, pdf'
121+
children:
122+
123+
- title: 'Testing the API'
124+
url: Testing-the-API.html
125+
output: 'web, pdf'
126+
127+
- title: 'Defining your testing strategy'
128+
url: Defining-your-testing-strategy.html
129+
output: 'web, pdf'
130+
131+
- title: 'Implementing features'
132+
url: Implementing-features.html
133+
output: 'web, pdf'
134+
135+
- title: 'Preparing the API for consumption'
136+
url: Preparing-the-API-for-consumption.html
137+
output: 'web, pdf'
138+
139+
- title: 'Extending LoopBack 4'
140+
url: Extending-LoopBack-4.html
141+
output: 'web, pdf'
142+
children:
143+
144+
- title: 'Creating Components'
145+
url: Creating-components.html
146+
output: 'web, pdf'
147+
148+
- title: 'Creating Decorators'
149+
url: Creating-decorators.html
150+
output: 'web, pdf'
151+
152+
- title: 'Testing your extension'
153+
url: Testing-your-extension.html
154+
output: 'web, pdf'
155+
156+
- title: 'Crafting LoopBack 4'
157+
url: Crafting-LoopBack-4.html
158+
output: 'web, pdf'
159+
160+
- title: 'Language-related concepts'
161+
url: Language-related-concepts.html
162+
output: 'web, pdf'
163+
children:
164+
165+
- title: 'Mixin'
166+
url: Mixin.html
167+
output: 'web, pdf'
168+
169+
- title: 'FAQ'
170+
url: FAQ.html
171+
output: 'web, pdf'
172+
173+
- title: 'Reference'
174+
url: Reference.html
175+
output: 'web, pdf'
176+
children:
177+
178+
- title: 'Reserved binding keys'
179+
url: Reserved-binding-keys.html
180+
output: 'web, pdf'
181+
182+
- title: 'Glossary'
183+
url: Glossary.html
184+
output: 'web, pdf'

docs/site/Application.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,17 @@ tasks as a part of your setup:
3232
import {Application} from '@loopback/core';
3333
import {RestComponent, RestServer} from '@loopback/rest';
3434
import {SamoflangeController, DoohickeyController} from './controllers';
35-
import {WidgetApi} from './apidef/';
3635

3736
export class WidgetApplication extends Application {
3837
constructor() {
3938
// This is where you would pass configuration to the base constructor
4039
// (as well as handle your own!)
41-
super();
40+
super({
41+
rest: {
42+
port: 8080
43+
}
44+
});
45+
4246
const app = this; // For clarity.
4347
// You can bind to the Application-level context here.
4448
// app.bind('foo').to(bar);
@@ -47,17 +51,6 @@ export class WidgetApplication extends Application {
4751
app.controller(DoohickeyController);
4852
}
4953

50-
async start() {
51-
// This is where you would asynchronously retrieve servers, providers and
52-
// other components to configure them before launch.
53-
const server = await app.getServer(RestServer);
54-
server.bind('rest.port').to(8080);
55-
server.api(WidgetApi);
56-
// The superclass start method will call start on all servers that are
57-
// bound to the application.
58-
return await super.start();
59-
}
60-
6154
async stop() {
6255
// This is where you would do whatever is necessary before stopping your
6356
// app (graceful closing of connections, flushing buffers, etc)
@@ -191,6 +184,15 @@ export class MyApplication extends RestApplication {
191184
## Tips for application setup
192185
Here are some tips to help avoid common pitfalls and mistakes.
193186

187+
### Extend from `RestApplication` when using `RestServer`
188+
If you want to use `RestServer` from our `@loopback/rest` package, we recommend you extend
189+
`RestApplication` in your app instead of manually binding `RestServer` or
190+
`RestComponent`. `RestApplication` already uses `RestComponent` and makes
191+
useful functions in `RestServer` like `handler()` available at the app level.
192+
This means you can call these `RestServer` functions to do all of your
193+
server-level setups in the app constructor without having to explicitly retrieve
194+
an instance of your server.
195+
194196
### Use unique bindings
195197
Use binding names that are prefixed with a unique string that does not overlap
196198
with loopback's bindings. As an example, if your application is built for

docs/site/Best-practices-with-Loopback-4.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,21 @@ permalink: /doc/en/lb4/Best-practices-with-Loopback-4.html
88
summary:
99
---
1010

11+
{% include important.html content="
12+
The API-first approach for building LoopBack
13+
applications is not yet fully supported. Therefore, some of the sections in this
14+
page are outdated and may not work out of the box. They will be revisited after
15+
our MVP release.
16+
" %}
17+
1118
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.
1219

1320
Our best practice follows an "API first" and test-driven development approach:
1421

15-
1. [**Defining and validating the API**](./Defining-and-validating-the-API.md): This section guides you through constructing your API first before any internal logic is added.
16-
2. [**Testing the API**](./Testing-the-API.md): This section describes the process of writing smoke test for your API and its spec.
17-
3. [**Defining your testing strategy**](./Defining-your-testing-strategy.md): This section discusses the advantages and the process of building a strong testing suite.
18-
4. [**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.
19-
5. [**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.
22+
1. **Defining the API**: There are two possible approaches to take in this section
23+
- [**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.
24+
- [**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*__
25+
- [**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*__
26+
2. [**Defining your testing strategy**](./Defining-your-testing-strategy.md): This section discusses the advantages and the process of building a strong testing suite.
27+
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.
28+
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.

0 commit comments

Comments
 (0)