This is my first time trying to store information to MySQL database. I made a server file with all the necessary dependencies implemented, as well as a database on port:8080 (localhost). When trying to send the information from server to database its not sending anything (I think because nothing shows up in database), but the web shows the res.send() message I insert.
My code:
const db = mysql.createConnection({
user:"root",
port:"8080",
host: "localhost",
password: "password",
database: "baza",
})
app.get("/", (req,res)=>{
const InsertSql= "INSERT INTO user_reg (`username`,`email`,`password`) VALUES ('vedo','lol','hi');"
db.query(InsertSql,(err,result)=>{
res.send("hi");
});//TODO
});
The word hi displays on port localhost/3001 but the information I want to send to DB using const InsertSql= "INSERT INTO user_reg (
username,
email,
password) VALUES ('vedo','lol','hi');"
does not.
If anyone knows how to resolve this issue it would be great, thanks in advance