diff --git a/src/app/homepage/pages/components/components.component.html b/src/app/homepage/pages/components/components.component.html index 88eb6d4a31..5939b6766d 100644 --- a/src/app/homepage/pages/components/components.component.html +++ b/src/app/homepage/pages/components/components.component.html @@ -55,7 +55,7 @@

Services

The CatsService is injected through the class constructor. Don't be afraid of the private readonly shortened - syntax. It means that we've created and initialized the catsService member immedietely in the same + syntax. It means that we've created and initialized the catsService member immediately in the same location.

Dependency injection

@@ -97,7 +97,7 @@

Property-based injection

In some very specific cases, a property-based injection might be useful. For instance, if your top-level class depends on either one or multiple providers, passing them all the way up by calling super() - in sub-classes from the constructor can be very annonying. Thus, in order to avoid it, you can use @Inject() + in sub-classes from the constructor can be very annoying. Thus, in order to avoid it, you can use @Inject() decorator on a property level.

@@ -145,4 +145,4 @@

Provider registration

main.ts
- \ No newline at end of file + diff --git a/src/app/homepage/pages/exception-filters/exception-filters.component.html b/src/app/homepage/pages/exception-filters/exception-filters.component.html index fa9637dfba..163dd004e8 100644 --- a/src/app/homepage/pages/exception-filters/exception-filters.component.html +++ b/src/app/homepage/pages/exception-filters/exception-filters.component.html @@ -9,7 +9,7 @@

Exception filters

- Each ocurred exception is handled by the global exception filter, and when it's + Each occurred exception is handled by the global exception filter, and when it's unrecognized (is neither HttpException nor a class that inherits from HttpException), a user receives the below JSON response: diff --git a/src/app/homepage/pages/interceptors/interceptors.component.html b/src/app/homepage/pages/interceptors/interceptors.component.html index 645a7bfc6f..8ecca74b7d 100644 --- a/src/app/homepage/pages/interceptors/interceptors.component.html +++ b/src/app/homepage/pages/interceptors/interceptors.component.html @@ -204,7 +204,7 @@

Stream overriding

Here's a CacheInterceptor with a hardcoded isCached variable and the hardcoded response [] as well. We returned a new stream here, created through the of operator, therefore the route handler won't be called at all. When someone calls endpoint that makes use of CacheInterceptor, the response - (a hardcoded, empty array) will be returned immedietely. In order to create a generic solution, you can take advantage + (a hardcoded, empty array) will be returned immediately. In order to create a generic solution, you can take advantage of Reflector and create a custom decorator. The Reflector is well described in the guards chapter.

@@ -222,4 +222,4 @@

Stream overriding

After 5 seconds the request processing will be canceled.

- \ No newline at end of file + diff --git a/src/app/homepage/pages/microservices/basics/basics.component.html b/src/app/homepage/pages/microservices/basics/basics.component.html index b5d3492fa5..0ef5235b30 100644 --- a/src/app/homepage/pages/microservices/basics/basics.component.html +++ b/src/app/homepage/pages/microservices/basics/basics.component.html @@ -14,7 +14,7 @@

Overview

In general, Nest supports a bunch of built-in transporters. They are based on request-response paradigm and a whole communication logic is hidden behind an abstraction layer. Thanks to that you can easily switch between transporters - without changing any line of your code. We don't support streaming platforms with log based persistance, such as Kafka or NATS streaming because they have been created to solve a different range of issues. However, you can still use them with Nest by making use of execution context feature. @@ -122,7 +122,7 @@

Client

{{ clientProxy }}

The ClientProxy is lazy. It doesn't initiate a connection immediately. Instead, it will - be established before the first microservice's call, and then reused across each subsequent call. However, if you want + be established before the first microservice call, and then reused across each subsequent call. However, if you want to delay an application's bootstrapping process and manually initialize a connection, you can use a connect() method inside the OnModuleInit lifecycle hook.

@@ -144,4 +144,4 @@

Client

to be equal to this one defined in the @MessagePattern() decorator, while payload is a message that we want to transmit to another microservice.

- \ No newline at end of file + diff --git a/src/app/homepage/pages/middlewares/middlewares.component.html b/src/app/homepage/pages/middlewares/middlewares.component.html index 6fa1311eb5..b6709d40d5 100644 --- a/src/app/homepage/pages/middlewares/middlewares.component.html +++ b/src/app/homepage/pages/middlewares/middlewares.component.html @@ -141,20 +141,19 @@

Asynchronous middleware

There are no contraindications that would prevent us from returning the async function within the resolve() method. Also, it's possible to make the resolve() method async as well. This common pattern is called - deffered middleware. + deferred middleware.

- {{ 'logger.middleware' | extension: defferedMiddlewareT.isJsActive }} - + {{ 'logger.middleware' | extension: deferredMiddlewareT.isJsActive }} + -
{{ defferedMiddleware }}
-
{{ defferedMiddlewareJs }}
+
{{ deferredMiddleware }}
+
{{ deferredMiddlewareJs }}

Functional middleware

The LoggerMiddleware is quite short. It has no members, no additional methods, no dependencies. Why can't - we just use a simple function? It's a good question, cause in fact - we can. This type of the middleware is called functional - middleware - . Let's transform the logger into a function. + we just use a simple function? It's a good question, cause in fact - we can. This type of the middleware is called + functional middleware. Let's transform the logger into a function.

{{ 'logger.middleware' | extension: functionalMiddlewareT.isJsActive }} @@ -194,4 +193,4 @@

Global middleware

app.use(logger); await app.listen(3000); - \ No newline at end of file + diff --git a/src/app/homepage/pages/middlewares/middlewares.component.ts b/src/app/homepage/pages/middlewares/middlewares.component.ts index 47fbfc0095..7185253057 100644 --- a/src/app/homepage/pages/middlewares/middlewares.component.ts +++ b/src/app/homepage/pages/middlewares/middlewares.component.ts @@ -263,7 +263,7 @@ export class LoggerMiddleware { }`; } - get defferedMiddleware() { + get deferredMiddleware() { return ` import { Injectable, NestMiddleware, MiddlewareFunction } from '@nestjs/common'; @@ -281,7 +281,7 @@ export class LoggerMiddleware implements NestMiddleware { }`; } - get defferedMiddlewareJs() { + get deferredMiddlewareJs() { return ` import { Injectable } from '@nestjs/common'; diff --git a/src/app/homepage/pages/migration/migration.component.html b/src/app/homepage/pages/migration/migration.component.html index b081fdde4a..3d8f80d765 100644 --- a/src/app/homepage/pages/migration/migration.component.html +++ b/src/app/homepage/pages/migration/migration.component.html @@ -65,10 +65,10 @@

Node.js

We follow the Node.js release schedule which recently moved to 8.x as an active LTS version. Therefore, Nest 5 supports >= 8.9.0 as the lowest version now. - This shift gaves us sustainable performance boosts thanks to the es2017 target of the TypeScript compilation. + This shift gave us sustainable performance boosts thanks to the es2017 target of the TypeScript compilation.

External libraries

Nest 5 doesn't support rxjs < 6.0.0. Keep in mind to upgrade this package as well.

- \ No newline at end of file + diff --git a/src/app/homepage/pages/modules/modules.component.html b/src/app/homepage/pages/modules/modules.component.html index 095902d444..503dcf230b 100644 --- a/src/app/homepage/pages/modules/modules.component.html +++ b/src/app/homepage/pages/modules/modules.component.html @@ -109,9 +109,9 @@

Modules re-exporting

The modules can export their internal providers. Moreover, they can re-export modules imported by themselves.

- + -
{{ reExportExamle }}
+
{{ reExportExample }}

Dependency injection

A module class can inject providers as well (e.g. for configuration purposes): @@ -180,4 +180,4 @@

Dynamic modules

decorator, which makes that Nest will always create the new instance of the module when it's imported by another one.

{{ singleScope }}
--> - \ No newline at end of file + diff --git a/src/app/homepage/pages/modules/modules.component.ts b/src/app/homepage/pages/modules/modules.component.ts index c4ba691132..b20bc0fd8e 100644 --- a/src/app/homepage/pages/modules/modules.component.ts +++ b/src/app/homepage/pages/modules/modules.component.ts @@ -111,7 +111,7 @@ export class CatsModule { }`; } - get reExportExamle() { + get reExportExample() { return ` @Module({ imports: [CommonModule], diff --git a/src/app/homepage/pages/pipes/pipes.component.html b/src/app/homepage/pages/pipes/pipes.component.html index d8907df3b5..b924b0848e 100644 --- a/src/app/homepage/pages/pipes/pipes.component.html +++ b/src/app/homepage/pages/pipes/pipes.component.html @@ -210,7 +210,7 @@
This section applies only to TypeScript.

The instance of - ValidationPipe has been created immedietely in-place. Another available way is to pass the class (not instance), + ValidationPipe has been created immediately in-place. Another available way is to pass the class (not instance), leaving framework the instantiation responsibility and enabling dependency injection.

@@ -361,4 +361,4 @@

A built-in ValidationPipe

Notice You may find more information about the class-validator package in its repository.
- \ No newline at end of file + diff --git a/src/app/homepage/pages/recipes/prisma/prisma.component.html b/src/app/homepage/pages/recipes/prisma/prisma.component.html index ca90c8afb5..7b9f364732 100644 --- a/src/app/homepage/pages/recipes/prisma/prisma.component.html +++ b/src/app/homepage/pages/recipes/prisma/prisma.component.html @@ -67,7 +67,7 @@

Integration

prisma.service
{{ prismaService }}

- Once PrismaService is ready, we need to create a correspoding module. + Once PrismaService is ready, we need to create a corresponding module.

prisma.module
{{ prismaModule }}
@@ -94,4 +94,4 @@

Example

A slightly modified example is available here.

- \ No newline at end of file + diff --git a/src/app/homepage/pages/recipes/sql-typeorm/sql-typeorm.component.html b/src/app/homepage/pages/recipes/sql-typeorm/sql-typeorm.component.html index ea6696fa5b..dc9f23a10d 100644 --- a/src/app/homepage/pages/recipes/sql-typeorm/sql-typeorm.component.html +++ b/src/app/homepage/pages/recipes/sql-typeorm/sql-typeorm.component.html @@ -36,7 +36,7 @@

Repository pattern

The TypeORM supports the repository design pattern, thus each entity has its own Repository. These repositories can be obtained from the database connection.

- But firstly, we need at least one entity. We are going to reuse the Photo entity from the offical documentation. + But firstly, we need at least one entity. We are going to reuse the Photo entity from the official documentation.

photo/photo.entity.ts
{{ photoEntity }}
@@ -68,4 +68,4 @@

Repository pattern

Hint Don't forget to import the PhotoModule into the root ApplicationModule.
- \ No newline at end of file + diff --git a/src/app/homepage/pages/recipes/swagger/swagger.component.html b/src/app/homepage/pages/recipes/swagger/swagger.component.html index 5ac195ddf3..ad5bcf29b3 100644 --- a/src/app/homepage/pages/recipes/swagger/swagger.component.html +++ b/src/app/homepage/pages/recipes/swagger/swagger.component.html @@ -47,6 +47,11 @@

Bootstrap

The SwaggerModule automatically reflects all of your endpoints. In the background, it's making use of swagger-ui-express and creates a live documentation.

+
+ Hint If you want to download the corresponding `Swagger JSON` file, you can simply call + http://localhost:3000/api-json in your browser (if your Swagger documentation is published under + http://localhost:3000/api). +

Body, query, path parameters

During the examination of the defined controllers, the SwaggerModule is looking for all used @Body(), @@ -122,7 +127,7 @@

Multiple specifications

setup() before you can start working on a second SwaggerOptions for a second Swagger Specification. This specific order is to - prevent Swagger configurations being overriden by different options. + prevent Swagger configurations being overridden by different options.

Working with enums

diff --git a/src/app/homepage/pages/techniques/caching/caching.component.html b/src/app/homepage/pages/techniques/caching/caching.component.html index bd7c99916d..6d8006e36c 100644 --- a/src/app/homepage/pages/techniques/caching/caching.component.html +++ b/src/app/homepage/pages/techniques/caching/caching.component.html @@ -11,8 +11,8 @@

Installation

$ npm install --save cache-manager

In-memory cache

- Nest provides a unified API for various cache storages. The built-in one is an in-memory data store. However, you can easily - switch to a more comprehensive solution, like Redis. In order to enable caching, firstly import CacheModule and + Nest provides a unified API for various cache storage providers. The built-in one is an in-memory data store. However, you can easily + switch to a more comprehensive solution, like Redis. In order to enable caching, firstly import CacheModule and call its register() method.

{{ inMemoryCache }}
@@ -55,7 +55,7 @@

Different stores

We take advantage of cache-manager under the hood. This package supports a wide-range of useful stores, for example, Redis store (full list here). To set up the Redis store, simple pass the package together with correspoding options to the + target="blank">here). To set up the Redis store, simple pass the package together with corresponding options to the register() method.

{{ redisStore }}
diff --git a/src/app/homepage/pages/techniques/compression/compression.component.html b/src/app/homepage/pages/techniques/compression/compression.component.html index 193d63d1be..70df5c1332 100644 --- a/src/app/homepage/pages/techniques/compression/compression.component.html +++ b/src/app/homepage/pages/techniques/compression/compression.component.html @@ -17,7 +17,7 @@

Installation

app.use(compression());
Hint - If you work wtih FastifyAdapter, consider using fastify-compress + If you work with FastifyAdapter, consider using fastify-compress instead.

diff --git a/src/app/homepage/pages/techniques/configuration/configuration.component.html b/src/app/homepage/pages/techniques/configuration/configuration.component.html index a2e9bda159..d9b46eb172 100644 --- a/src/app/homepage/pages/techniques/configuration/configuration.component.html +++ b/src/app/homepage/pages/techniques/configuration/configuration.component.html @@ -63,7 +63,7 @@

Using the ConfigService

app.service.ts
{{ configServiceInjection }}
- Instead of importing ConfigModule repeatingly in all your modules, you can also declare ConfigModule as + Instead of importing ConfigModule in all your modules, you can also declare ConfigModule as a global module.

Advanced configuration

@@ -79,7 +79,7 @@

Advanced configuration

a lack of validation of the provided .env file
  • - the env file provides booleans as string ('true'), and thus have to cast them to a boolean every + the env file provides booleans as string ('true'), and thus have to cast them to a boolean every time
  • @@ -120,4 +120,4 @@

    Usage example

    app.service.ts
    {{ advancedConfigServiceSample }}
    - \ No newline at end of file + diff --git a/src/app/homepage/pages/techniques/file-upload/file-upload.component.html b/src/app/homepage/pages/techniques/file-upload/file-upload.component.html index b998eafd63..4ca6b4b162 100644 --- a/src/app/homepage/pages/techniques/file-upload/file-upload.component.html +++ b/src/app/homepage/pages/techniques/file-upload/file-upload.component.html @@ -39,10 +39,10 @@

    Array of files

    we use @UploadedFiles() decorator

    - + -
    {{ multipleFiles }}
    -
    {{ multipleFilesJs }}
    +
    {{ multipleFiles }}
    +
    {{ multipleFilesJs }}
    Hint Both FilesInterceptor() and @UploadedFiles() decorator are exposed from @nestjs/common package. @@ -94,4 +94,4 @@

    Async configuration

    It works the same as useClass with one critical difference - MulterModule will lookup imported modules to reuse already created ConfigService, instead of instantiating it on its own.

    - \ No newline at end of file + diff --git a/src/app/homepage/pages/techniques/logger/logger.component.html b/src/app/homepage/pages/techniques/logger/logger.component.html index 95c6fe4d85..132e1259ec 100644 --- a/src/app/homepage/pages/techniques/logger/logger.component.html +++ b/src/app/homepage/pages/techniques/logger/logger.component.html @@ -36,7 +36,7 @@

    Dependency injection

    {{ loggerModule }}

    Once LoggerModule is imported anywhere, the framework will take charge of creating an instance of your logger. - Now, to use the same instance of a logger across the whole app, including bootstraping and error handling stuff, use + Now, to use the same instance of a logger across the whole app, including bootstrapping and error handling stuff, use following construction:

    {{ useLoggerDi }}
    @@ -44,4 +44,4 @@

    Dependency injection

    The only downside of this solution is that your first initialization messages won't be handled by your logger instance, though, it shouldn't really matter at this point.

    - \ No newline at end of file + diff --git a/src/app/homepage/pages/techniques/security/security.component.html b/src/app/homepage/pages/techniques/security/security.component.html index eca172e390..5ad4ad1280 100644 --- a/src/app/homepage/pages/techniques/security/security.component.html +++ b/src/app/homepage/pages/techniques/security/security.component.html @@ -66,7 +66,7 @@

    Rate limiting

    {{ expressRateLimit }}
    Hint - If you work wtih FastifyAdapter, consider using FastifyAdapter, consider using fastify-rate-limit instead.
    - \ No newline at end of file + diff --git a/src/app/homepage/pages/techniques/serialization/serialization.component.html b/src/app/homepage/pages/techniques/serialization/serialization.component.html index 35c594ac41..69cfc038cc 100644 --- a/src/app/homepage/pages/techniques/serialization/serialization.component.html +++ b/src/app/homepage/pages/techniques/serialization/serialization.component.html @@ -5,7 +5,7 @@

    Serialization

    For instance, sensitive data like user's password should be always excluded from the eventual response. Furthermore, certain properties might require additional transformation, let's say, we don't want to send the whole database entity. Instead, we would like to pick only id and name. The rest should be automatically stripped. - Unluckily, manually mapping all entities may bring a lot of confusedness. + Unluckily, manually mapping all entities may bring a lot of confusion.

    Overview

    @@ -53,15 +53,15 @@

    Pass options

    The @SerializeOptions() decorator is imported from @nestjs/common package.

    - These opions will be passed as a second argument of the classToPlain() function. + These options will be passed as a second argument of the classToPlain() function.

    Websockets & Microservices

    - All these guidelines cornern both WebSockets as well as microservices, regardless of transport method that is being used. + All these guidelines concern both WebSockets as well as microservices, regardless of transport method that is being used.

    Learn more

    In order to read more about available decorators, options, visit this page.

    - \ No newline at end of file + diff --git a/src/app/homepage/pages/techniques/sql/sql.component.html b/src/app/homepage/pages/techniques/sql/sql.component.html index 0700e91083..92e098b6b9 100644 --- a/src/app/homepage/pages/techniques/sql/sql.component.html +++ b/src/app/homepage/pages/techniques/sql/sql.component.html @@ -54,7 +54,7 @@

    Repository pattern

    each entity has its own Repository. These repositories can be obtained from the database connection.

    - Firstly, we need at least one entity. We're gonna reuse the Photo entity from the offical documentation. + Firstly, we need at least one entity. We're gonna reuse the Photo entity from the official documentation.

    {{ 'photo/photo.entity' | extension: photoEntityT.isJsActive }} @@ -194,4 +194,4 @@

    Example

    A working example is available here.

    - \ No newline at end of file + diff --git a/src/app/homepage/pages/websockets/adapter/adapter.component.html b/src/app/homepage/pages/websockets/adapter/adapter.component.html index fe7421ae28..077caf743e 100644 --- a/src/app/homepage/pages/websockets/adapter/adapter.component.html +++ b/src/app/homepage/pages/websockets/adapter/adapter.component.html @@ -49,7 +49,7 @@

    Ws library

    Another built-in adapter is a WsAdapter which in turn acts like a proxy between the framework and integrate blazing fast and thoroughly tested ws library. This adapter is fully compatible with native browser WebSockets and is far faster than socket.io package. Unluckily, it has significantly - fewer functionalities available out-of-the-box. In some cases, you may just don't necesserily need them though. + fewer functionalities available out-of-the-box. In some cases, you may just don't necessarily need them though.

    {{ setupAdapter }}
    @@ -59,7 +59,7 @@

    Advanced (custom adapter)

    For demonstration purposes, we are going to handwritten integrate the ws library. As mentioned, the adapter for this library is already created and is exposed from the @nestjs/websockets package - as a WsAdapter class. Here is how the simplified implementation could potentialy looks like: + as a WsAdapter class. Here is how the simplified implementation could potentially looks like:

    {{ 'ws-adapter' | extension: wsAdapterT.isJsActive }} @@ -83,4 +83,4 @@

    Example

    A working example that uses WsAdapter is available here.

    - \ No newline at end of file +