Skip to content
This repository has been archived by the owner on Jan 25, 2025. It is now read-only.

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ionStici committed Oct 27, 2024
1 parent 6cc96b4 commit 8e8a41d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion mds/nest/decorators-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ export class AuthGuard implements CanActivate {
constructor(private reflector: Reflector) {}

canActivate(context: ExecutionContext): boolean {
const isPublic = this.reflector.get("isPublic", context.getHandler());
const isPublic = this.reflector.getAllAndOverride("isPublic", [
context.getHandler(),
context.getClass(),
]);

if (isPublic) return true; // Allow access to public routes

Expand Down
4 changes: 2 additions & 2 deletions mds/nest/dependency-injection.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

- **Dependency Injection (DI)** in NestJS is a technique used to implement **Inversion of Control (IoC)** for resolving dependencies.

- **Inversion of Control (IoC):** The responsibility of creating and managing dependencies is delegated to NestJS.
- **Inversion of Control (IoC):** The responsibility of creating and managing dependencies is delegated to the system (NestJS).

- NestJS manages a **dependency graph** and knows the correct order in which to instantiate classes.

Expand Down Expand Up @@ -56,7 +56,7 @@ import { SignInProvider } from "./sign-in.provider";

@Injectable()
export class UsersService {
// Inject a provider to make its method available for use
// Inject a provider to make its methods available for use
constructor(private readonly signInProvider: SignInProvider) {}

public signIn() {
Expand Down
2 changes: 1 addition & 1 deletion mds/nest/jwt-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Install NestJS JWT Package

```ts
```bash
npm i @nestjs/jwt
```

Expand Down
2 changes: 1 addition & 1 deletion mds/nest/nest-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class AppController {
}
```

- `@Controller()` : Marks the class as a controller. In handles incoming requests, in this case at the root path (`/`).
- `@Controller()` : Marks the class as a controller. It handles incoming requests, in this case at the root path (`/`).

- `@Get()` : Maps the `getHello()` method to handle GET http requests.

Expand Down
2 changes: 1 addition & 1 deletion mds/nest/pipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ export class PostsController {
- If `id` is `'abc'`, it will result in a validation error, and NestJS will automatically throw a Bad Request error.
- Even if `id` is marked as optional (e.g. `/:id?`), pipes like `ParseIntPipe` will assume that the parameter is required, unless explicitly handles using techniques like DTOs.

- **`DefaultValuePipe`** : Pipe used to assign a default value of they are not provided in the request.
- **`DefaultValuePipe`** : Pipe used to assign a default value if not provided in the request.

0 comments on commit 8e8a41d

Please sign in to comment.