@hodfords/nestjs-response 10.2.0 → 10.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +80 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,80 @@
1
+ <p align="center">
2
+ <a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
3
+ </p>
4
+
5
+ [circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
6
+ [circleci-url]: https://circleci.com/gh/nestjs/nest
7
+
8
+ <p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
11
+ <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
12
+ <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
13
+ <a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
14
+ <a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
15
+ <a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
16
+ <a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
17
+ <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
18
+ <a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
19
+ <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
20
+ <a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
21
+ </p>
22
+ <!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
23
+ [![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
24
+
25
+ # nestjs-response
26
+ For response, use sync, not async.
27
+
28
+ ## Installation 🤖
29
+
30
+ ```
31
+ npm install @hodfords/nestjs-response --save
32
+
33
+ ```
34
+
35
+ ```typescript
36
+ class UserResponse {
37
+ @ApiProperty()
38
+ @IsNotEmpty()
39
+ @IsString()
40
+ name: string
41
+ }
42
+
43
+ class UserController{
44
+ @Get()
45
+ @ResponseModel(UserResponse, true)
46
+ getAllUser() {
47
+ return [{name: "hello"}]
48
+ }
49
+
50
+ @Get()
51
+ @ResponseModel(UserResponse, true, true)
52
+ getUser() {
53
+ return undefined
54
+ }
55
+ }
56
+
57
+ ```
58
+
59
+ - `Interceptor global`
60
+ ```javascript
61
+ {
62
+ providers: [
63
+ {
64
+ provide: APP_INTERCEPTOR,
65
+ useClass: LoggingInterceptor
66
+ }
67
+ ]
68
+ }
69
+ ```
70
+
71
+ - `Interceptor decorator`
72
+
73
+ This option is not recommended. Just use for microservice, let use global interceptor
74
+ ```javascript
75
+ @Controller('test')
76
+ @UseResponseInterceptor()
77
+ export class TestController {
78
+
79
+ }
80
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hodfords/nestjs-response",
3
- "version": "10.2.0",
3
+ "version": "10.2.1",
4
4
  "description": "Standardizes and validates API responses in NestJS for consistent and reliable communication",
5
5
  "author": "",
6
6
  "license": "UNLICENSED",