@kien2k1/nestjs-utils
v1.0.0
Published
Utilities SDK to support reusable helpers, constants, and decorators for NestJS-based applications
Maintainers
Readme
@kien2k1/nestjs-utils v1.0.0
The @kien2k1/nestjs-utils library exported as a Utilities module.
Installation
Using npm:
$ npm i -g npm
$ npm i --save @kien2k1/nestjs-utilsIn Node.js:
// Load the full build.
import * as vnt from '@kien2k1/nestjs-utils';
// Load the specific function.
import { VNT_StandardApiHeaders } from '@kien2k1/nestjs-utils';
import { VNT_StandardApiQueries } from '@kien2k1/nestjs-utils';
import { VNT_StandardAPIErrorResponse } from '@kien2k1/nestjs-utils';
import { VNT_APIErrorResponse } from '@kien2k1/nestjs-utils';
import { VNT_StandardApiHeaders } from '@kien2k1/nestjs-utils';
import { VNT_GetValidationNestedException } from '@kien2k1/nestjs-utils';
// Using decorator
@Post()
@ApiOperation({ summary: 'Something' })
@ApiBody({
type: RequestDto,
required: true,
description: 'RequestDto',
})
@ApiResponse({
status: 200,
description: 'Successfully!.',
type: ResponseDTO,
})
@VNT_StandardApiHeaders()
@VNT_APIErrorResponse(['PERMISSION_DENIED'])
@VNT_StandardAPIErrorResponse()
async addPassengers(@Req() req: Request, @Body() body: BodyDto): Promise<ResponseDTO> {
return doSomethingLogic(req, body);
}Note: Install using node 12 hehehe!
Why @kien2k1/nestjs-utils?
@kien2k1/nestjs-utils provides a collection of modular utility functions to simplify the development of NestJS-based APIs. It helps standardize headers, query validation, and API error responses across services.
You can import only what you need
