@nitra/fastify 2.5.2 → 2.5.4
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 +3 -3
- package/src/index.js +5 -5
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nitra/fastify",
|
|
3
3
|
"description": "Fastify helper",
|
|
4
|
-
"version": "2.5.
|
|
4
|
+
"version": "2.5.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"files": [
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@fastify/sensible": "^6.0.3",
|
|
26
|
-
"@nitra/pino": "^2.
|
|
27
|
-
"fastify": "^5.6.
|
|
26
|
+
"@nitra/pino": "^2.8.0",
|
|
27
|
+
"fastify": "^5.6.2"
|
|
28
28
|
}
|
|
29
29
|
}
|
package/src/index.js
CHANGED
|
@@ -9,14 +9,14 @@ export const log = getLogger()
|
|
|
9
9
|
|
|
10
10
|
export const app = fastify({
|
|
11
11
|
loggerInstance: getLogger(),
|
|
12
|
-
bodyLimit: Number(env.BODY_LIMIT_MB || 1) * 1024 * 1024
|
|
13
|
-
http2: !!env.K_SERVICE // Запускаємо з http2 якщо в Cloud Run
|
|
12
|
+
bodyLimit: Number(env.BODY_LIMIT_MB || 1) * 1024 * 1024
|
|
13
|
+
// http2: !!env.K_SERVICE // Запускаємо з http2 якщо в Cloud Run
|
|
14
14
|
})
|
|
15
15
|
|
|
16
16
|
app.register(fastifySensible) // для reply.badRequest(`Not found url: ${req.url} ...`)
|
|
17
17
|
|
|
18
18
|
// Опрацювання запитів OPTIONS
|
|
19
|
-
app.options('/*', (
|
|
19
|
+
app.options('/*', (_req, reply) => {
|
|
20
20
|
// + setHeaders в preHandler
|
|
21
21
|
reply.header('Access-Control-Max-Age', 86400)
|
|
22
22
|
reply.header('Cache-Control', 'public, max-age=86400')
|
|
@@ -60,8 +60,8 @@ export function listen() {
|
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
*
|
|
63
|
-
* @param {
|
|
64
|
-
* @param {
|
|
63
|
+
* @param {import('fastify').FastifyRequest} req req
|
|
64
|
+
* @param {import('fastify').FastifyReply} reply reply
|
|
65
65
|
*/
|
|
66
66
|
function setHeaders(req, reply) {
|
|
67
67
|
let host = env.ORIGIN || req.headers.origin || req.headers.referer
|