Saturday, 18 July 2020

Database connection

I am making an app in NodeJs but I am actually quite newbie wrt NodeJs. The app I am making shows a canvas with circles and the size and color of the circles are stored in an SQL database. I have in the top folder a file app.js. Then I have a folder containing the HTML file with the canvas, css file, and a javascript file index.js that draws everything in the Canvas.The problem I have is getting the data from the database. I can get the data of the database in app.js. No problem with the connection there. But I need to pass this data to index.js. I tried to do an export and then use a require in index.js but I get the error message that I can't use require in index.js because it is client side.Can anyone point me out what I need to do to get the data in index.js ? I tried searching on the internet but I didn't find a good explanation that I managed to understand. Maybe someone here knows a good tutorial or youtube video on this ?

Submitted July 18, 2020 at 10:59PM by anti-Casta

No comments:

Post a Comment