Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kammradt/learning-nestjs

๐Ÿ”บWe are on quarentine, so lets study another JS framework ๐Ÿคท๐Ÿปโ€โ™‚๏ธ ๐Ÿ”บ
https://github.com/kammradt/learning-nestjs

api nest nestjs rest typescript

Last synced: 6 days ago
JSON representation

๐Ÿ”บWe are on quarentine, so lets study another JS framework ๐Ÿคท๐Ÿปโ€โ™‚๏ธ ๐Ÿ”บ

Awesome Lists containing this project

README

        


Nest Logo

Welcome to my learning proccess with NestJS โœ๏ธ




## Description ๐Ÿ“

> Hi there!
> I will update this repo with new information as soon as I build something cool ๐Ÿ˜…
> **Update**: Course finished! ๐Ÿฅฐ Now I just need to find a problem to be solved ๐Ÿค”

## Sections ๐Ÿคน๐Ÿปโ€โ™‚๏ธ

- [X] Basic structure to perform CRUD ([this tag](https://github.com/kammradt/learning-nestjs/tree/crud-with-fake-data))
- [X] Basic usage of pipes and validation on DTOs ([this tag](https://github.com/kammradt/learning-nestjs/tree/using-pipes-and-validation))
- [X] Using persistence and queryBuilder([this tag](https://github.com/kammradt/learning-nestjs/tree/persistence-and-query-builder))
- [X] Adding basic Jwt Authentication ([this tag](https://github.com/kammradt/learning-nestjs/tree/adding-basic-auth))
- [X] Adding Authorization ([this tag](https://github.com/kammradt/learning-nestjs/tree/adding-authorization))
- [X] Adding Tests with Jest ([this tag](https://github.com/kammradt/learning-nestjs/tree/adding-tests))
- [X] Adding secure responses (@Exclude instead of DTOs) ([this tag](https://github.com/kammradt/learning-nestjs/tree/adding-global-dto-solution))
- [X] Adding role based authorization (ADMIN section)([this tag](https://github.com/kammradt/learning-nestjs/tree/adding-role-based-authorization))

## Useful links ๐Ÿ”—

- `class-validator` Annotations can be found [here](https://github.com/typestack/class-validator#validation-decorators)
- `TypeORM` [here](https://typeorm.io/)
- `queryBuilder` by `TypeORM` [here](https://github.com/typeorm/typeorm/blob/master/docs/select-query-builder.md)
- `queryBuilder with find { }` [here](https://github.com/typeorm/typeorm/blob/master/docs/find-options.md)
- Using a `ClassSerializerInterceptor` to hide sensitive data (instead of ResponseDTOs) [here](https://docs.nestjs.com/techniques/serialization#exclude-properties)
- How to add it globally [here](https://stackoverflow.com/questions/55720448/nestjs-how-to-setup-classserializerinterceptor-as-global-interceptor)
- Using roles on handlers [here](https://docs.nestjs.com/guards#setting-roles-per-handler)
- More details can be found [here](https://docs.nestjs.com/fundamentals/execution-context#reflection-and-metadata).
I chose the `.getAndOverride` approach, where a `Controller` level has a default `Role`, and some `actions (methods)` inside it can have more specific/restricted roles.

## Stay in touch ๐Ÿค— ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป

- Author - [Vinicius Kammradt](https://kammradt.now.sh)
- Twitter - [@kammzinho](https://twitter.com/kammzinho)