I am new to Node.js and right now I am trying to display all my images of a logged in user from my database to my ejs file. I have set up all the code but i have a problem where I don’t know how to properly display all images. I have also tried async functions but i don’t seem
Tag: node.js
Select and join with sequelize
How to make this code with the sequelize? I used include, but it brings all the user data but I only need the name my code: Answer If you just want to reduce User model attributes then just indicate needed attributes in the attributes option: If you want to add a user’s name as a string prop at the same
How to look for a specific thing within a table with postgres/nodejs
I’m currently using postgres, accessing it through a node server. I’m feeling stuck on how I would search for a specific term within a table in order to make a change. I know I can SELECT certain items, but I don’t know how to search within the items. say my table is: animal cuddly scary Medium Dog yes no Small
Getting ‘error: syntax error at or near…’ in Postgresql insert query
I’m fairly new at Postgresql and learning new things everyday. So I have this blog project where I want to use PostgreSQL as a db. But I’m kind of stuck at the most basic insert query which is throwing an error. I have three tables, posts, authors and categories. I could create the table properly I guess but when I
Cannot connect to database stored on aws from Heroku or Replit websites. (mysql2, node.js)
Problem: My discord.js bot isn’t connecting to the mysql database on aws. The bot is being hosted on replit and also on heroku but for some reason I can’t connect to both. I have tried connecting to the database from my laptop and it worked fine, I even hosted the bot on my laptop to see if there was a
What do I do to user data that is currently not verified?
Good day, I’m new to backend coding. What do I do to user data that did not confirm verification code from email during registration? Should I save it to database forever or do I have to delete it after a set of limited time when verified boolean is not met? I’m sorry if this is so beginner question. Answer It’s
how to select the max of COUNT(*) (SQL postgresql)
I switched from NOSQL to SQL and i can’t find how to select the max of count(*) i created users table, posts and comments. i want to select TOP 10 users with the max of posts and max of comments Answer First, using SQL database require you to define the JOIN statement between the associated tables to get the referenced
Got an error while executing query {“statusCode”:500,”error”:”Internal Server Error”,”message”:”syntax error at or near “)””}
I have a db with a primary key address I want to write a request that would delete rows that match the address that I pass in the array. I have this in my missing-urls.js file and use this query in my query/missing-urls.js file When I run this request I got an error. What I am doing wrong? Answer You
Nested SQL.promise() callback in Javascript
I want to write a nested callback JavaScript in order to use the subsequent ID’s of the INSERT statements in the different SQL tables. My code looks as follows: However, when trying to run this with Node.js it says Error: Callback function is not available with promise clients. Do you have a solution to retrieve the insert IDs for the
Can someone clarify what is happening in this part of the code?
So I have part of code like this I have database where I have table-categories and table-items categories table and items look like this: What I don’t understand is what happens with categories and inventory in this part of code -> Do they get joined? Also in this part what item means here, there is no column named item in