skip to Main Content

Redis – Fastify plugin usage

I'm studying Fastify and register plugin with @fastify/redis like this app.register(redisPlugin, { client: initRedis(app.config.REDIS_INTERNAL__HOST, app.config.REDIS_INTERNAL__PASS), closeClient: true, }); And register route: import { FastifyInstance, FastifyPluginAsync } from "fastify"; import v1Routes from "./v1/index.js"; const routes: FastifyPluginAsync = async (fastify: FastifyInstance): Promise<void>…

VIEW QUESTION

Json – Fastify – TypeError: Cannot read property 'length' of undefined

When i created a new API with fastify, while testing it, it was throwing TypeError: Cannot read property 'length' of undefined at next (node_modules/fastify/lib/route.js:407:32) at preParsingHookRunner (node_modules/fastify/lib/route.js:438:3) at runPreParsing (node_modules/fastify/lib/route.js:389:5) at Object.routeHandler [as handler] (node_modules/fastify/lib/route.js:349:7) at Router.lookup (node_modules/find-my-way/index.js:356:14) The control…

VIEW QUESTION

Mongodb – Can you help me find why Mongoose returns this undefined error in Object.isPOJO?

I'll be grateful if you can help me understand an error generated by mongoose. Log Error: TypeError: Cannot read properties of undefined (reading 'name') at Object.isPOJO (C:Users[...]node_modulesmongooselibutils.js:396:38) at Object.toObject (C:[...]node_modulesmongooselibutils.js:354:15) at model.Query.Query.find (C:[...]node_modulesmongooselibquery.js:2341:22) at Function.find (C:[...]node_modulesmongooselibmodel.js:2244:13) at Object.exports.findMatches (C:[...]controllersmatches.js:13:11) at…

VIEW QUESTION

Use fastify-redis from controllers in node.js

How to use fastify-redis plugin from other controllers or other.js while declaring the redis connection in server.js server.js const fastify = require('fastify')({ logger: false }) const routes = require('./routes') fastify.register(require('fastify-redis'), { host: '127.0.0.1' }) routes.forEach((route, index) => { fastify.route(route) })…

VIEW QUESTION
Back To Top
Search