I have a form that just takes two inputs, which are then passed to the /addpost-disabled endpoint, and inserted into the SQL test database. It runs fine but it keeps loading, what would be an easy fix?
ps. I removed the connection.end() method as it triggered an error and I could only add input once.
app.post('/addpost-disabled', urlencodedParser, (req, res) => {
console.log('backend got an api endpoit hit');
console.log('starting query')
connection.query(`insert into test(title, description) values (?, ?)`,
[req.body.postTitle, req.body.postDescr],
(error, results) => {
if(error) console.log(error);
console.log('inserted these values into test database')
console.log(req.body.postTitle);
console.log(req.body.postDescr);
console.log('ending connection');
}
)
})