Here is a piece of Node.js code
app.get('/cat', function (req, res) {
console.log(req.query.id);
let catID = req.query.id;
res.render('category',{});
con.query(
'SELECT * FROM category WHERE id = '+catID,
function (error, result) {
if(error) throw err;
console.log(JSON.parse(JSON.stringify(result)));
});
});

Don't know what is this and how to fix it
You are receiving err but trying to throw error. Use below code.
app.get('/cat', function (req, res) {
console.log(req.query.id);
let catID = req.query.id;
res.render('category',{});
con.query(
'SELECT * FROM category WHERE id = '+catID,
function (error, result) {
if(error) throw error;
console.log(JSON.parse(JSON.stringify(result)));
});
});
Disclaimer: Use parameterized query instead of adding query param to db queries. Current code will cause SQL injection threat.