@athenna/http 1.1.5 → 1.1.8
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@athenna/http",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "The Athenna Http server. Built on top of fastify",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "João Lenon <lenon@athenna.io>",
|
|
@@ -158,9 +158,9 @@
|
|
|
158
158
|
}
|
|
159
159
|
},
|
|
160
160
|
"dependencies": {
|
|
161
|
-
"@athenna/config": "1.0.
|
|
162
|
-
"@athenna/ioc": "1.1.
|
|
163
|
-
"@athenna/logger": "1.1.
|
|
161
|
+
"@athenna/config": "1.0.7",
|
|
162
|
+
"@athenna/ioc": "1.1.2",
|
|
163
|
+
"@athenna/logger": "1.1.4",
|
|
164
164
|
"@secjs/utils": "1.8.3",
|
|
165
165
|
"fastify": "3.27.4",
|
|
166
166
|
"reflect-metadata": "0.1.13",
|
|
@@ -18,9 +18,9 @@ declare module 'fastify' {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
export declare class FastifyHandler {
|
|
21
|
-
static createOnSendHandler(handler: InterceptHandlerContract): (req:
|
|
22
|
-
static createDoneHandler(handler: HandleHandlerContract): (req:
|
|
23
|
-
static createResponseHandler(handler: TerminateHandlerContract): (req:
|
|
21
|
+
static createOnSendHandler(handler: InterceptHandlerContract): (req: FastifyRequest, _res: any, payload: any) => Promise<any>;
|
|
22
|
+
static createDoneHandler(handler: HandleHandlerContract): (req: FastifyRequest, res: FastifyReply, done: any) => any;
|
|
23
|
+
static createResponseHandler(handler: TerminateHandlerContract): (req: FastifyRequest, res: FastifyReply, done: any) => any;
|
|
24
24
|
static createErrorHandler(handler: ErrorHandlerContract): (error: any, req: FastifyRequest, res: FastifyReply) => any;
|
|
25
25
|
static createRequestHandler(handler: HandlerContract): (req: FastifyRequest, res: FastifyReply) => Promise<any>;
|
|
26
26
|
}
|
package/src/Http.js
CHANGED
|
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.Http = void 0;
|
|
15
15
|
const fastify_1 = __importDefault(require("fastify"));
|
|
16
|
-
const FastifyHandler_1 = require("./
|
|
16
|
+
const FastifyHandler_1 = require("./Handlers/FastifyHandler");
|
|
17
17
|
class Http {
|
|
18
18
|
/**
|
|
19
19
|
* Instantiate Http class and fastify server.
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.HttpKernel = void 0;
|
|
4
4
|
const config_1 = require("@athenna/config");
|
|
5
5
|
const logger_1 = require("@athenna/logger");
|
|
6
|
-
const HttpErrorHandler_1 = require("../Handlers/HttpErrorHandler");
|
|
7
6
|
const utils_1 = require("@secjs/utils");
|
|
7
|
+
const HttpErrorHandler_1 = require("../Handlers/HttpErrorHandler");
|
|
8
8
|
class HttpKernel {
|
|
9
9
|
/**
|
|
10
10
|
* Returns an instance of any class that extends HttpKernel.
|
|
@@ -18,9 +18,9 @@ class HttpKernel {
|
|
|
18
18
|
httpServer.setErrorHandler(HttpErrorHandler_1.HttpErrorHandler.handler);
|
|
19
19
|
if (config_1.Config.get('http.log')) {
|
|
20
20
|
httpServer.use(async (ctx) => {
|
|
21
|
-
await new logger_1.Logger().channel('
|
|
22
|
-
return ctx.
|
|
23
|
-
}, '
|
|
21
|
+
await new logger_1.Logger().channel('request').log(ctx);
|
|
22
|
+
return ctx.next();
|
|
23
|
+
}, 'terminate');
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
/**
|