I have successfully connected my custom server using Node.js and Express.js with Next.js. I’m trying to fetch a car by its id whenever I click it among other cars, so I can have that particular car only. But I keep getting an error saying params is undefined even though I get the id at the back of my li…
Tag: node.js
Axios is returning empty string value
The problem I’m facing here was, whenever I fetch the data with a button click (the button that leads to this route), the data will be fetch successfully, but whenever I input the link address directly myself in the browser, It keeps returning empty string when i console.log the data (Like this <empt…
Can’t overwrite javascript array
I need to monitor results . If the results.length increases, the array will be overwritten and saved. If the length decreases, then the array will be overwritten, but the new value won’t save. Answer I found de wae!
Firefox stops receiving responses after some HTTP requests (React + Axios, Node.js backend), sends only OPTIONS
As the title says, this only happens in Firefox. After some time the browser only sends OPTIONS requests with no responses, no status, no headers, nothing I can see in the debug console. All of this works perfectly under Chrome, Safari and Edge. I’ve already set up CORS middleware and headers within Nod…
Jest command not recognized
So i just started learning about Test Driven Developement and as an example i was asked to run the command npm test helloWorld.spec.js in the terminal but i got this error : I’m working on windows and the only thing i have installed is node so what do i have to do? Answer Choose one of the following met…
Cannot verify JWT – UnhandledPromiseRejectionWarning: JsonWebTokenError: jwt malformed
I have function that just send data to database (my posts). I use private and public keys to sign and verify tokens. I can send this token in header from front-end to back-end, but has problem with verifying it. Here is how this flow looks like: Front-end Back-end Middleware auth And JWT service The problem s…
How to get users in voice channel without cache in DiscordJS?
I’m trying to get all users connected to a voice channel on my server. When someone talks to a bot in #general, I want to get the users inside Voice Channel 1. I’m using Node 17 and DiscordJS 13. This is my code: Also, I tried this one: But, it always returns the voice channel users that joined wh…
trying to understand async / await / sync in node
i know this probably has been asked before, but coming from single-threaded language for the past 20 years, i am really struggling to grasp the true nature of node. believe me, i have read a bunch of SO posts, github discussions, and articles about this. i think i understand that each function has it’s …
create custom nested output from json using javascript
I am trying to save data in json object by using map function but the problem is I can save data by using needed_key:value.arrayData.key needed_value:value.arrayData.value if all the needed_key and needed_value are same I can use above code but here problem is key name is same but the needed_value get change …
Koa & Passport Missing credentials
I have a Koa server that uses Passport to authenticate users against an Array, and a React client. After successful login, the following requests are not authenticated as the cookie is undefined. The authenticate function’s error parameter has: After browsing the site, I fixed the usual errors, calling …