I get this error when I execute code ,I want to access server_queue playing TypeError: Cannot read properties of undefined (reading ‘playing’) This is my code: Answer After skipping your first if block when server_queue doesn’t exist, you are then trying to access playing on top of the nonex…
Tag: node.js
Cannot GET routes other than “/” express
I’m trying to create a web app with the MVC pattern and express in node.js. This is my project structure: project structure image app.js: loginController.js: The problem is that I can access the index page (“/”) but not the login page (“/login”) even when the code for both is alm…
Reading PORT number from .env file in nestjs
I have details defined in .env file. Below is my code. host: process.env.SMTP_HOST is working properly. but when I am writing process.env.SMTP_PORT it is saying you can not assign string to number. when I wrote parseInt(process.env.SMTP_PORT) it is still not working. how to assign port from .env file Answer p…
How should I insert data to MYSQL database from a HTML form?
I know that node runs on the backend and while it’s not a problem to connect to the SQL database via the server.js file, I cannot understand how I could do that from within a js linked to a form element (that’s definitely client-side js, and I cannot make the connection from inside there). I know …
Error while installing node module in ReactJs
I just cloned a React application from Git that doesn’t have node_modules on it. I try to install with command npm install but unable to do it. Following error occurs when installing the npm. I even tried with npm install –legacy-peer-deps but doesn’t work. How can I fix this issue? Answer T…
Cannot read properties of undefined (reading ‘slice’)
I can’t figure out the problem with the code as I have even matched it with the source code provided by the git user and it is same, but still showing error So below is the error:- Below is the code for shortenAddress component:- Below is the code of the Welcome component Please,can someone tell the ans…
Next.js and Express.js give CORS error, API queries only work at build time
I have a project where I use Next.js on the front-end and Express.js on the back. Front-end side The ‘pages’ file contains ‘index.js’. In it, I am sending the following request. Back-end side And here is my Route code : So, When the page is first built with Next.js, the api works, but …
Handling [object Promise] from noblox.js in discord.js
Surprisingly difficult to find this on google… So I’m making a discord bot with discord.js and connecting a noblox.js bot to it. Payout is commented because I do not want to yet, I am just trying to make messaging work. Output on discord when I type the !payout command: Answer You have to await th…
MongoDB match expression query not working
MongoDb query match expression not working. I have a posts collection and want to return only those posts which match the user Id of the user who created it but my query does not seem to be working. Sample Dataset MongoDb Query:- Query Output:- The query does not work output contains posts created by all user…
How to store data from a MariaDB in my node.js environment
I have a MariaDB that stores Energy-Data like voltage, frequency and so on. My aim is to visualize the data in a Web-application. Though i achieved to connect the MariaDB to node.js and log the data on a specific port thanks to the code below, i don’t have a clue how to store this data for further mathe…