@nitra/fastify 2.3.1 → 2.5.0

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,15 +1,14 @@
1
1
  {
2
2
  "name": "@nitra/fastify",
3
3
  "description": "Fastify helper",
4
- "version": "2.3.1",
4
+ "version": "2.5.0",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "files": [
8
8
  "src"
9
9
  ],
10
10
  "exports": {
11
- ".": "./src/index.js",
12
- "./pubsub": "./src/pubsub.js"
11
+ ".": "./src/index.js"
13
12
  },
14
13
  "keywords": [
15
14
  "nitra",
@@ -24,7 +23,7 @@
24
23
  "license": "MIT",
25
24
  "dependencies": {
26
25
  "@fastify/sensible": "^6.0.3",
27
- "@nitra/pino": "^2.0.0",
28
- "fastify": "^5.4.0"
26
+ "@nitra/pino": "^2.2.0",
27
+ "fastify": "^5.5.0"
29
28
  }
30
29
  }
package/src/index.js CHANGED
@@ -25,8 +25,8 @@ app.options('/*', (req, reply) => {
25
25
  reply.code(200).send()
26
26
  })
27
27
 
28
- app.get('/healthz', function (_request, reply) {
29
- reply.code(200).send({ statusCode: 200, status: 'ok' })
28
+ app.get('/healthz', { logLevel: 'silent' }, () => {
29
+ return { status: 'ok' }
30
30
  })
31
31
 
32
32
  app.addHook('preHandler', (req, reply, done) => {
package/src/pubsub.js DELETED
@@ -1,34 +0,0 @@
1
- import logger from '@nitra/pino'
2
- import fastify from 'fastify'
3
- import { env, exit } from 'node:process'
4
-
5
- const port = Number(env.PORT) || 8080
6
-
7
- export const app = fastify({
8
- logger,
9
- http2: !!env.K_SERVICE // Запускаємо з http2 якщо в Cloud Run
10
- })
11
-
12
- // app.addHook('preHandler', (req, _, done) => {
13
- // req.log = getLogger(req)
14
- // req.log.info('req.url: ', req.url)
15
-
16
- // done()
17
- // })
18
-
19
- app.get('/healthz', function (_request, reply) {
20
- reply.code(200).send({ statusCode: 200, status: 'ok' })
21
- })
22
-
23
- /**
24
- * Запускаємо сервер
25
- */
26
- export function listen() {
27
- app
28
- .listen({ port, host: '0.0.0.0' })
29
- .then(address => console.log(`🚀 PubSub Consumer ready at ${address}`))
30
- .catch(error => {
31
- console.error('Error starting server:', error)
32
- exit(1)
33
- })
34
- }