I have a problem with my xhr. The xhr status returns always 200. However, in my condition if it does not take it into account. In the condition it goes directly to the else while the xhr.status returns the response 200. In the condition I put an if the response was 200 then it was using this : However, he
Tag: node.js
Multer – Cannot read property ‘buffer’ of undefined
I have a problem uploading an image file to my server, I watched some tutorials on YouTube about multer and I do exactly the same thing that is done in the tutorial and for whatever reason, I get an error: (“Cannot read property ‘buffer’ of undefined”), and req.file is also undefined. …
Why does this dynamic programming optimization actually make code slower?
This is from Leetcode problem: Concatenated Words. Below is a working solution. I added what I thought to be an optimization (see code comment), but it actually slows down the code. If I remove the wrapping if statement, it runs faster. To me, the optimization helps avoid having to: call an expensive O(n) sub…
Typescript’s declaration merging not working as expected using ts-node
For a project using the express-session package, I’m trying to mutate the session object by simply adding a user key. Coming from this question’s accepted answer, I understand I could use declaration merging to extend the SessionData interface, using my own interface. Looking at various open-sourc…
.env for prod and developpment with nodejs
I saw lot of different ways, some looked normal some others looked a bit more patchworked. Can we use package json script to chose our env variables ? What is the right way to do it with nodeJS and how to do it ? I have already made an .env. It contains api keys which are global for dev and
Discord user roles are undefined TypeError: Cannot read property ‘cache’ of undefined
I added this new command in my bot, when members execute the command ;;time, the bot goes through the roles and gives them the claim time. I have given my code along with the error. Any possible solution to fix the error? And here is the error : I searched on google and stack overflow for answers but couldn&#…
Cannot create type as specific number when number is in variable
I want to create a type that can be only 1 or root 2. This works: But when I try to use Math.SQRT2, or any variable reference to the numeric value of root 2, I get an error. For example: Typescript playground demonstrating the issue In my code I want to be able to reference the root of 2 with
Discord.js user isnt mentioned
I have a problem with sending messages when a user is tagged or not, I’m working on the pp command (as in dankmemer) but after adding the code so that I can tag a person the bot crashes, what I mean is that after tagging a person it will send a message in the title it will say the user’s
I want to make custom array of object based on my result [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 1 year ago. Improve this question Basica…
Nodejs Extra Data in FormData
I am sending a http request with a file to Sharepoint. Some file types, such as png or other images become corrupted and unreadable. When looking at those I see extra object data at the head e.g. and at the bottom: Is there a way to prevent this? The code I am using looks like: Answer I was eventually able