1.0.0 • Published 2 years ago

@buildery/nest-utils v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Description

Nestjs Useful implementations:

  • Decorators
  • Guards

Decorators:

  • Cookie Decorator Use
    async post(@Cookies('refreshToken') refreshTokenCookie: string) {
        const {accessToken, refreshToken} = await this.authService.refresh(refreshTokenCookie);
    }
  • Get data from Header
 async post(@Header('authorization') authHeader: string) {
    if (!authHeader) throw new Error('Not authorized!');
}
  • Skip Guard if
import {SkipGuardIf} from "./skip-guard-if.decorator";

@Post()
@SkipGuardIf((request) => request === null, AuthGuard)
async post(){
    
}
  • Skip Guard if advanced

Guards:

  • Set Meta If
  • Set Meta If Advanced
  • Skip If Meta

Nest framework TypeScript starter repository.

Use

installation

$ npm install @builder/nest-utils