So I am building a shopping cart, I am done with most of my code but when I try to increment or decrement the value of a product quantity from cart it just fetches me the value of current quantity it doesn’t get updated. I am unable to understand where I am making the mistake. This is my cart.js file
Tag: node.js
Unable to read standard emoji name from reaction [discord.js]
Hey I’m doing a bot and I need to get the name of the emoji from the reaction. I did it for now with console.log () but I was surprised because I got some kind of weird badge instead of the emoji name. I got the emoji 🎉 :tada: for the news and I was expecting something like this in
Catch (failed)net::ERR_NAME_NOT_RESOLVED in an Ember / Ember Data app
I’m working on an Ember app which uses Ember Data. We mainly use Rails and Postgres for the backend, but a smaller portion of our data is stored in a WordPress backend. WordPress is running on wp.example.com. Ember Data is setup to work with both the Rails and WordPress backends, so I can do things like…
Example node.js ftp server?
I need to create a node.js app that connects to this ftp server and downloads files from this directory: ftp://www.ngs.noaa.gov/cors/rinex/2021/143/nynb I’ve tried following the ftp npm package docs but I feel like I am doing something horribly wrong: When I run npm run dev with nodemon I get: Can someo…
Discord Bot unexpectedly exits with error when successfully banning someone
The problem that I have is with the case “ban”. When I go “+ban” and then mention the user, it works. The user is banned and the message is sent but then it exits with a message error about the Discord API and permission, even though I have admin permission for the bot. And when I don&…
Integrating PayPal with backend that uses authentication headers
In my backend Node.js code, I use middleware to require authentication so all routes are accessible with authorization header. After payment approval on a PayPal page, the redirection back to the success route happens without this authorization header, so the success route is unfortunately inaccessible. How c…
Lookup table with weak references in Javascript
I have a tree structure with elements dynamically added and removed. The elements are loaded dynamically from the network. What I want to achieve is to have a lookup table that maps the element’s id to the actual element in the tree. Now, the problem when using a simple Map or Object is that it holds st…
How should I call this node.js function?
I’m following a Node.js tutorial, it gave me the following code to start: It asked me to finish the app, so I did this, and it worked: However when I clicked the “check your work” button, it said that I did it wrong. The correct answer ended up being this: I have a couple of questions about …
Unit testing a method that creates a JWT and returns Error: secretOrPrivateKey must have a value
I am trying to write a unit test for the method I wrote which generates a JWT. I am doing the following Note: I am not using expect yet, and seeing if the method works in first place by logging the result of the method to the console And I receive the following error: Error: secretOrPrivateKey must have a val…
How to dynamically find main rectangular image within an image?
I’d like to take a screenshot of an image, and extract the image out of the screenshot. For example: I’d like to dynamically extract that image out of the screenshot. However, I want to be able to dynamically detect where the image to be extracted is in the screenshot image. So for example, if I s…