I am not looking for a piece of code to copy- I am stuck. I used the MySQL driver in node to connect to the SQL database and inserted data into the table. It works fine, but I want to show the data from that table into HTML. I would use client-side js to do something like someDiv.textContent = results but client side doesn't allow me to connect to the database. I could create an endpoint for /showPosts and have it connect to the database but I don't know how I'm going to pass the results I get to the frontend. Any help would be appreciated. Thanks :)
In your frontend client, you cant use the fetch api or something like axios to do a GET request to obtain data from your /showPosts endpoint. Then you can display that data on the client side.