1.0.14 • Published 3 years ago
nest-view v1.0.14
Nest View
Nest view is a module created to make easy data manipulation inside an application based on NestJS.
Instalation
This module is available in npm registry.
Dependencies
The first step to use this module is create a simple application based on NestJS.
Next step: install @nestjs/swagger in your application.
Now just install the module using npm command
$ npm install nest-view
Features
- Create views to manipulate data
- Use view to validate data
- Use views to make schemas to use in nestJS swagger documentation
Usage
The first step to use this module is to create a view
View example
import { PropView, View } from 'nest-view';
@View()
export class Example {
@PropView({ type: String })
name: string;
@PropView({ type: Number })
age: number;
}
Now you're able to use this view to manipulate data and use to document your request's in swagger.
Swagger documentation
import { Body, Controller, Get } from '@nestjs/common';
import { ApiBodyView } from 'nest-view';
import { Example } from './view';
@Controller()
export class AppController {
@Get()
@ApiBodyView(Example)
getHello(@Body() body: Example) {
return;
}
}