All Projects → chanlito → nestjs-extensions

chanlito / nestjs-extensions

Licence: other
[WIP] A bunch of useful and opinionated filters, modules, pipes... to use with Nest framework. 😻

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to nestjs-extensions

prime-nestjs
A production-ready NestJS boilerplate using Typescript, Postgres, TypeORM, and Docker.
Stars: ✭ 140 (+225.58%)
Mutual labels:  nest, nestjs
nest-xray
Distributed tracing for Nestjs with AWS X-Ray as the backend. Instrument incoming and outgoing HTTP requests
Stars: ✭ 50 (+16.28%)
Mutual labels:  nest, nestjs
nestjs-asyncapi
NestJS AsyncAPI module - generate the documentation of your event-based services using decorators
Stars: ✭ 88 (+104.65%)
Mutual labels:  nest, nestjs
nestjs-ioredis
IORedis module for Nest
Stars: ✭ 21 (-51.16%)
Mutual labels:  nest, nestjs
discord-nestjs
👾 NestJS package for discord.js
Stars: ✭ 173 (+302.33%)
Mutual labels:  nest, nestjs
nestjs-objection
Objection module for NestJS
Stars: ✭ 24 (-44.19%)
Mutual labels:  nest, nestjs
nestjs-starter
🚀 Nest framework starter
Stars: ✭ 30 (-30.23%)
Mutual labels:  nest, nestjs
MyAPI
A template to create awesome APIs easily ⚡️
Stars: ✭ 117 (+172.09%)
Mutual labels:  nest, nestjs
nestjs-session
Idiomatic Session Module for NestJS. Built on top of `express-session` 😎
Stars: ✭ 150 (+248.84%)
Mutual labels:  nest, nestjs
typegraphql-nestjs
TypeGraphQL integration with NestJS
Stars: ✭ 117 (+172.09%)
Mutual labels:  nest, nestjs
nest-queue
Queue manager for NestJS Framework for Redis (via bull package)
Stars: ✭ 69 (+60.47%)
Mutual labels:  nest, nestjs
azure-serverless-deprecated
[Deprecated] Azure Serverless module for Nest framework (node.js) 🌩
Stars: ✭ 44 (+2.33%)
Mutual labels:  nest, nestjs
twitch-project
A weekly stream in which I build a web application with Neo4j and Typescript
Stars: ✭ 78 (+81.4%)
Mutual labels:  nest, nestjs
nestjs-telegraf
🤖 Powerful Nest module for easy and fast creation Telegram bots
Stars: ✭ 300 (+597.67%)
Mutual labels:  nest, nestjs
nestjs-ratelimiter
Distributed consistent flexible NestJS rate limiter based on Redis
Stars: ✭ 49 (+13.95%)
Mutual labels:  nest, nestjs
bundled-nest
💥 Nest 🔰 Webpack 🔰 Docker 💥 --- 🏯 Now archived for historical reference ⛩
Stars: ✭ 59 (+37.21%)
Mutual labels:  nest, nestjs
Notadd
A microservice development architecture based on nest.js. —— 基于 Nest.js 的微服务开发架构。
Stars: ✭ 2,556 (+5844.19%)
Mutual labels:  nest, nestjs
Jwt
JWT utilities module based on the jsonwebtoken package 🔓
Stars: ✭ 232 (+439.53%)
Mutual labels:  nest, nestjs
ogma
A monorepo for the ogma logger and related packages
Stars: ✭ 201 (+367.44%)
Mutual labels:  nest, nestjs
unnue-nuxt
开媛笔记,基于nuxt ssr首屏服务器端渲染 ⚡。用于分享、记录、交流和学习,希望可以帮助到小伙伴们。同时网站在永久更新,备好鸡血,一起来战 Ooh aah!
Stars: ✭ 98 (+127.91%)
Mutual labels:  nest, nestjs

NestJS Extensions

[WIP] A bunch of useful and opinionated filters, modules, pipes... to use with Nest framework. 😻

Setup

npm install nestjs-extensions@latest

Usage

  • ApplicationExceptionFilter is a nestjs filter use to catch all exceptions & errors in the application.

    import { ApplicationExceptionFilter } from 'nestjs-extensions';
    // ... other imports
    
    const app = await NestFactory.create();
    
    app.useGlobalFilters(new ApplicationExceptionFilter());
  • DtoPipe & Dto is used for validation. Internally it uses class-transformer & class-validator.

    • Step 1 - use the pipe, it requires a nestjs Reflector.
    import { DtoPipe } from 'nestjs-extensions';
    // ... other imports
    
    const app = await NestFactory.create();
    
    app.useGlobalPipes(new DtoPipe(new Reflector()));
    • Step 2 - create a file called create-post.dto.ts
    import { Transform } from 'class-transformer';
    import { IsNotEmpty, IsOptional, IsString } from 'class-validator';
    import { Dto } from 'nestjs-extensions';
    
    @Dto()
    export class CreatePostDto {
      @IsNotEmpty()
      @IsString()
      title!: string;
    
      @IsString()
      @IsOptional()
      description?: string;
    
      @IsNotEmpty()
      @Transform(x => +x)
      count!: number;
    }
    • Step 3 - use it inside your controller
    // ...
    @Controller('posts')
    export class PostsController {
      @Post()
      async createPost(@Body() { title, description, count }: CreatePostDto) {
        return { title, description, count };
      }
    }
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].