Skip to content

Commit 359e517

Browse files
Merge branch 'master' into docs/graphql-v10-update
2 parents 160bd3d + 30b09fe commit 359e517

File tree

10 files changed

+23
-16
lines changed

10 files changed

+23
-16
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(The MIT License)
22

3-
Copyright (c) 2017-2021 Kamil Myśliwiec <http://kamilmysliwiec.com>
3+
Copyright (c) 2017-2022 Kamil Myśliwiec <http://kamilmysliwiec.com>
44

55
Permission is hereby granted, free of charge, to any person obtaining
66
a copy of this software and associated documentation files (the

content/discover/who-uses.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@
254254
"https://forwardigital.co.uk",
255255
"https://rozetka.com.ua",
256256
"https://www.itrio.net",
257+
"https://alexishr.com",
257258
"https://dyrector.io",
258259
"https://stijlbreuk.nl"
259260
]

content/graphql/federation.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ import { UsersService } from './users.service'; // Not included in this example
145145
export class AppModule {}
146146
```
147147

148+
A working example is available [here](https://github.com/nestjs/nest/tree/master/sample/31-graphql-federation-code-first/users-application) in code first mode and [here](https://github.com/nestjs/nest/tree/master/sample/32-graphql-federation-schema-first/users-application) in schema first mode.
149+
148150
#### Federated example: Posts
149151

150152
Post service is supposed to serve aggregated posts through the `getPosts` query, but also extend our `User` type with the `user.posts` field.
@@ -337,6 +339,8 @@ import { PostsService } from './posts.service'; // Not included in example
337339
export class AppModule {}
338340
```
339341

342+
A working example is available [here](https://github.com/nestjs/nest/tree/master/sample/31-graphql-federation-code-first/posts-application) for the code first mode and [here](https://github.com/nestjs/nest/tree/master/sample/32-graphql-federation-schema-first/posts-application) for the schema first mode.
343+
340344
#### Federated example: Gateway
341345

342346
Start by installing the required dependency:
@@ -375,6 +379,8 @@ import { GraphQLModule } from '@nestjs/graphql';
375379
export class AppModule {}
376380
```
377381

382+
A working example is available [here](https://github.com/nestjs/nest/tree/master/sample/31-graphql-federation-code-first/gateway) for the code first mode and [here](https://github.com/nestjs/nest/tree/master/sample/32-graphql-federation-schema-first/gateway) for the schema first mode.
383+
378384
#### Federation with Mercurius
379385

380386
Start by installing the required dependencies:

content/interceptors.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export class ErrorsInterceptor implements NestInterceptor {
236236
return next
237237
.handle()
238238
.pipe(
239-
catchError(err => throwError(new BadGatewayException())),
239+
catchError(err => throwError(() => new BadGatewayException())),
240240
);
241241
}
242242
}
@@ -251,7 +251,7 @@ export class ErrorsInterceptor {
251251
return next
252252
.handle()
253253
.pipe(
254-
catchError(err => throwError(new BadGatewayException())),
254+
catchError(err => throwError(() => new BadGatewayException())),
255255
);
256256
}
257257
}
@@ -311,9 +311,9 @@ export class TimeoutInterceptor implements NestInterceptor {
311311
timeout(5000),
312312
catchError(err => {
313313
if (err instanceof TimeoutError) {
314-
return throwError(new RequestTimeoutException());
314+
return throwError(() => new RequestTimeoutException());
315315
}
316-
return throwError(err);
316+
return throwError(() => err);
317317
}),
318318
);
319319
};
@@ -330,9 +330,9 @@ export class TimeoutInterceptor {
330330
timeout(5000),
331331
catchError(err => {
332332
if (err instanceof TimeoutError) {
333-
return throwError(new RequestTimeoutException());
333+
return throwError(() => new RequestTimeoutException());
334334
}
335-
return throwError(err);
335+
return throwError(() => err);
336336
}),
337337
);
338338
};

content/middlewares.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ The `MiddlewareConsumer` is a helper class. It provides several built-in methods
143143
import { Module, NestModule, MiddlewareConsumer } from '@nestjs/common';
144144
import { LoggerMiddleware } from './common/middleware/logger.middleware';
145145
import { CatsModule } from './cats/cats.module';
146-
import { CatsController } from './cats/cats.controller.ts';
146+
import { CatsController } from './cats/cats.controller';
147147

148148
@Module({
149149
imports: [CatsModule],
@@ -159,7 +159,7 @@ export class AppModule implements NestModule {
159159
import { Module } from '@nestjs/common';
160160
import { LoggerMiddleware } from './common/middleware/logger.middleware';
161161
import { CatsModule } from './cats/cats.module';
162-
import { CatsController } from './cats/cats.controller.ts';
162+
import { CatsController } from './cats/cats.controller';
163163

164164
@Module({
165165
imports: [CatsModule],

content/security/authentication.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ Ensure the app is running, and test the routes using `cURL`.
761761
```bash
762762
$ # GET /profile
763763
$ curl http://localhost:3000/profile
764-
$ # result -> {"statusCode":401,"error":"Unauthorized"}
764+
$ # result -> {"statusCode":401,"message":"Unauthorized"}
765765

766766
$ # POST /auth/login
767767
$ curl -X POST http://localhost:3000/auth/login -d '{"username": "john", "password": "changeme"}' -H "Content-Type: application/json"

content/security/helmet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### Helmet
22

3-
[Helmet](https://github.com/helmetjs/helmet) can help protect your app from some well-known web vulnerabilities by setting HTTP headers appropriately. Generally, Helmet is just a collection of 14 smaller middleware functions that set security-related HTTP headers (read [more](https://github.com/helmetjs/helmet#how-it-works)).
3+
[Helmet](https://github.com/helmetjs/helmet) can help protect your app from some well-known web vulnerabilities by setting HTTP headers appropriately. Generally, Helmet is just a collection of smaller middleware functions that set security-related HTTP headers (read [more](https://github.com/helmetjs/helmet#how-it-works)).
44

55
> info **Hint** Note that applying `helmet` as global or registering it must come before other calls to `app.use()` or setup functions that may call `app.use()`. This is due to the way the underlying platform (i.e., Express or Fastify) works, where the order that middleware/routes are defined matters. If you use middleware like `helmet` or `cors` after you define a route, then that middleware will not apply to that route, it will only apply to middleware defined after the route.
66

content/techniques/http-module.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,6 @@ If you want to reuse an existing options provider instead of creating a private
128128
```typescript
129129
HttpModule.registerAsync({
130130
imports: [ConfigModule],
131-
useExisting: ConfigService,
131+
useExisting: HttpConfigService,
132132
});
133133
```

content/websockets/gateways.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $ npm i --save @nestjs/websockets @nestjs/platform-socket.io
2121

2222
#### Overview
2323

24-
In general, each gateway is listening on the same port as the **HTTP server**, unless your app is not a web application, or you have changed the port manually. This default behavior can be modified by passing an argument to the `@WebSocketGateway(80)` decorator where `80` is a chosen port number. You can also set a [namespace](https://socket.io/docs/rooms-and-namespaces/) used by the gateway using the following construction:
24+
In general, each gateway is listening on the same port as the **HTTP server**, unless your app is not a web application, or you have changed the port manually. This default behavior can be modified by passing an argument to the `@WebSocketGateway(80)` decorator where `80` is a chosen port number. You can also set a [namespace](https://socket.io/docs/v4/namespaces/) used by the gateway using the following construction:
2525

2626
```typescript
2727
@WebSocketGateway(80, { namespace: 'events' })
@@ -99,7 +99,7 @@ handleEvent(client, data) {
9999
}
100100
```
101101

102-
In the example above, the `handleEvent()` function takes two arguments. The first one is a platform-specific [socket instance](https://socket.io/docs/server-api/#socket), while the second one is the data received from the client. This approach is not recommended though, because it requires mocking the `socket` instance in each unit test.
102+
In the example above, the `handleEvent()` function takes two arguments. The first one is a platform-specific [socket instance](https://socket.io/docs/v4/server-api/#socket), while the second one is the data received from the client. This approach is not recommended though, because it requires mocking the `socket` instance in each unit test.
103103

104104
Once the `events` message is received, the handler sends an acknowledgment with the same data that was sent over the network. In addition, it's possible to emit messages using a library-specific approach, for example, by making use of `client.emit()` method. In order to access a connected socket instance, use `@ConnectedSocket()` decorator.
105105

src/app/homepage/newsletter/services/newsletter.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { HttpClient } from '@angular/common/http';
22
import { Injectable } from '@angular/core';
3-
import { empty } from 'rxjs';
3+
import { EMPTY } from 'rxjs';
44
import { catchError } from 'rxjs/operators';
55

66
@Injectable({ providedIn: 'root' })
@@ -12,7 +12,7 @@ export class NewsletterService {
1212
'https://z93f42xq2l.execute-api.us-east-2.amazonaws.com/Stage/newsletter?token=db1f899025b5a59a76b6b34b2a013893';
1313
return this.httpClient
1414
.post(newsletterUrl, { email })
15-
.pipe(catchError(() => empty()))
15+
.pipe(catchError(() => EMPTY ))
1616
.toPromise();
1717
}
1818
}

0 commit comments

Comments
 (0)