@nano-app/backend 0.6.0 → 0.6.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.
- package/dist/http/Endpoint.d.ts +1 -1
- package/dist/http/Endpoint.js +2 -2
- package/package.json +1 -1
package/dist/http/Endpoint.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare abstract class Endpoint<BeforeResult = any> {
|
|
|
7
7
|
constructor(path?: string);
|
|
8
8
|
/** Metodos envoltorios */
|
|
9
9
|
protected BEFORE(_req: Request): Promise<BeforeResult>;
|
|
10
|
-
protected AFTER(_result: ApiResponse): Promise<ApiResponse>;
|
|
10
|
+
protected AFTER(_req: Request, _result: ApiResponse, _method: string): Promise<ApiResponse>;
|
|
11
11
|
/**
|
|
12
12
|
* Métodos HTTP opcionales - las clases hijas solo implementan los que necesiten
|
|
13
13
|
* Si no se implementan, se lanza un error por defecto
|
package/dist/http/Endpoint.js
CHANGED
|
@@ -19,7 +19,7 @@ class Endpoint {
|
|
|
19
19
|
BEFORE(_req) {
|
|
20
20
|
return Promise.resolve({});
|
|
21
21
|
}
|
|
22
|
-
AFTER(_result) {
|
|
22
|
+
AFTER(_req, _result, _method) {
|
|
23
23
|
return Promise.resolve(_result);
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
@@ -50,7 +50,7 @@ class Endpoint {
|
|
|
50
50
|
}
|
|
51
51
|
this.BEFORE(req)
|
|
52
52
|
.then((beforeParams) => handler(req, res, beforeParams))
|
|
53
|
-
.then(result => this.AFTER(result))
|
|
53
|
+
.then(result => this.AFTER(req, result, method))
|
|
54
54
|
.then(result => res.json({
|
|
55
55
|
success: true,
|
|
56
56
|
...result
|