From 295ff660525d977f80aa7391f80a37e7e13a16d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20My=C5=9Bliwiec?= Date: Thu, 21 Dec 2017 14:24:26 +0100 Subject: [PATCH] Auto stash before merge of "master" and "origin/master" --- .../pages/components/components.component.html | 4 ++-- .../pages/controllers/controllers.component.html | 4 ++-- .../exception-filters/exception-filters.component.html | 10 +++++----- .../pages/middlewares/middlewares.component.html | 6 +++--- src/styles.scss | 6 ++++++ 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/app/homepage/pages/components/components.component.html b/src/app/homepage/pages/components/components.component.html index a1c6c8f98a..be9d8758aa 100644 --- a/src/app/homepage/pages/components/components.component.html +++ b/src/app/homepage/pages/components/components.component.html @@ -11,7 +11,7 @@

Components

The controllers should only handle HTTP requests and delegate more complex tasks to the components. The components are a plain TypeScript classes with @Component() decorator.

-
+
Hint Since Nest enables the possibility to design, organize the dependencies in more OO-way, we strongly recommend to follow the SOLID principles.
@@ -50,7 +50,7 @@

Dependency Injection

Nest is built around the strong design pattern, which is commonly known as a Dependency Injection. There's a great article about this concept in the official Angular documentation.

-
+
Hint Learn more about the Dependency Injection in Nest here.

diff --git a/src/app/homepage/pages/controllers/controllers.component.html b/src/app/homepage/pages/controllers/controllers.component.html index a79d1defc8..8873eb5018 100644 --- a/src/app/homepage/pages/controllers/controllers.component.html +++ b/src/app/homepage/pages/controllers/controllers.component.html @@ -59,7 +59,7 @@

Request object

In fact, Nest is using express request object. We can force Nest to inject the request object into handler using @Req() decorator.

-
+
Hint There's a @types/express package and we strongly recommend to use it (Request has its own typings).
@@ -144,7 +144,7 @@

Async / await

We love modern JavaScript, and we know that the data extraction is mostly asynchronous. That's why Nest supports async functions, and works pretty well with them.

-
+
Hint Learn more about async / await here!

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 a2b76739ba..717da34be6 100644 --- a/src/app/homepage/pages/exception-filters/exception-filters.component.html +++ b/src/app/homepage/pages/exception-filters/exception-filters.component.html @@ -24,8 +24,8 @@

HttpException

{{ createMethod }}
{{ createMethodJs }}
-
- Notice I've used the HttpStatus here. It's just a helper enum imported from the @nestjs/common package. +
+ Warning I have used the HttpStatus here. It's a helper enum imported from the @nestjs/common package.

Now when the client will call this endpoint, the response would looks like below: @@ -103,7 +103,7 @@

Exception Filters

The response is a native express response object. The exception is a currently processed exception.

-
+
Hint Every exception filter should implement the ExceptionFilter interface. It forces to provide the catch() method with the proper signature.

@@ -119,8 +119,8 @@

Exception Filters

{{ forbiddenCreateMethodWithFilter }}
{{ forbiddenCreateMethodWithFilterJs }}
-
- Hint The @UseFilters() decorator is imported from the @nestjs/common package. +
+ Warning The @UseFilters() decorator is imported from the @nestjs/common package.

We've used the @UseFilters() decorator here. Same as @Catch(), it takes infinite count of parameters. diff --git a/src/app/homepage/pages/middlewares/middlewares.component.html b/src/app/homepage/pages/middlewares/middlewares.component.html index c79b2aa990..96a260ffe3 100644 --- a/src/app/homepage/pages/middlewares/middlewares.component.html +++ b/src/app/homepage/pages/middlewares/middlewares.component.html @@ -51,7 +51,7 @@

Where to put the middlewares?

{{ applicationModule }}
{{ applicationModuleJs }}
-
+
Hint We could pass here (inside forRoutes()) the single object and just use RequestMethod.ALL.

@@ -69,7 +69,7 @@

Where to put the middlewares?

{{ applicationModuleByControllers }}
{{ applicationModuleByControllersJs }}
-
+
Hint The apply() method can take single middleware or an array of middlewares.

Pass arguments to the middleware

@@ -128,7 +128,7 @@

Functional Middlewares

{{ applyFunctionalMiddleware }}
{{ applyFunctionalMiddlewareJs }}
-
+
Hint Let's consider to use functional middlewares everytime when your middleware doesn't have any dependencies.
\ No newline at end of file diff --git a/src/styles.scss b/src/styles.scss index ace3f05262..32017a2542 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -62,6 +62,12 @@ blockquote { &::before { background: #ed8529; } strong, a { color: #ed8529; } } + + &.info { + background: rgba(8, 148, 226, 0.038); + &::before { background: #0894e2; } + strong, a { color: #0894e2 } + } } figure {