I've learned how to fetch information from the MySQL database, but I can not manipulate this data to expose it in HTML pages. The code that I will expose below I got from w3school:
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "yourusername",
password: "yourpassword",
database: "mydb"
});
con.connect(function(err) {
if (err) throw err;
con.query("SELECT * FROM customers", function (err, result, fields) {
if (err) throw err;
console.log(result);
});
});
Pay attention to the part that I get the data, it is stored in the variable result, but you can not manipulate this information outside the scope of the function. How do I get this data and put the result in an HTML page? Is it possible to do this without a framework? If not, which framework to use?