so i am making a small chat lobby project. But im having issues with getting the messages people are sending to the server, back to the clients to show them on the site. It kind of worked using a loop like this: However this is obviosly really bad, and if you started spamming, or too many clients joined, it overloaded
Tag: node.js
Problem using VS Code’s Code Runner to run js file
I’ve installed the vs code extension Code Runner to help me learn JS, but it doesn’t seem to be working. When I try to run this simple console log, I get no output in vs code terminal, just this message: “[Running] node “c:UsersvaioDesktopreactscript.js” and nothing else, not even the massage saying that the execution ended. At the same time, if
discord bot replies 1 to 2 times
i am currently working on this discord bot but when i call a command it responds twice. would anyone know how to fix this? Answer Have you tried shutting down all other processes of your bot (Google Cloud, AWS …)? The bot could login twice and act like 2 bots, replying twice to the command Happened to me once
Set checkbox label’s text in modal
I have a modal for creating new post. I want to allow the user to select departments for sharing so I’m using checkboxes for choosing the audience. HTML: Different users have different departments to be shown and they are saved in mongoDB user document. I need to set the labels of the checkboxes on loading the modal. I’m getting user’s
Why I got Illegal arguments error with simple hash function?
This is my code I run I expected hashed password. Why does terminal point to illegal arguments? Answer In an object literal, password : bcrypt.hash(this.password, salt) calls bcrypt.hash and assigns its return value to the password property. In the code you’ve shown, this doesn’t refer to the object being created, it refers to the same thing this refers to where
Sending info and variables between Client-Side and Server-Side
so I have an express.js server, I don’t quite understand how I can send and receive I have (for example) an input for someone to write his email , I want the email to be sent to the server, validated, and then an email function sends an email to that user, However, my issue is that I don’t know how
Webpack 5 and ESM
I think I’ve read every thread on SO and every related page on the internet on this, everything has some variation of a problem I want: To use webpack to bundle my web app up To use ES Modules within my source js and have them transpiled down for wider browser support To use ES Modules within my webpack configuration
Node.js express – body of POST request is always empty
I am trying to read the body of POST request using Express in Node.JS framework. I send a HTTP POST request using HTML form. I detected a POST request on WireShark with the following data: This shows that the request is sent successfully. I expected JSON format, which is the one that Express successfully parsed for me, but this format
Fix the upstream dependency conflict installing NPM packages
I am trying to npm install vue-mapbox mapbox-gl, and I’m getting a dependency tree error. I’m running Nuxt.js SSR with Vuetify and haven’t installed anything related to Mapbox prior to running this install and am getting this error. What’s the right way to go about fixing this upstream dependency conflict? Answer It looks like it’s a problem with peer dependencies
Discord: Get User by Id
I’m trying to create a web application to manage the users of my Discord server. In my database, I have stored only the users’ ids. I tried to use the discord.js API, but from what I’ve understood it requires a discord bot to do that. That’s not what I want. I would like to retrieve the user’s information from my