I have the following code on my Node.JS server that queries a database:
if(response.context.rfc){
var valorRFC = response.context.rfc;
connection.query('SELECT * FROM pruebas.Usuarios2 where RFC = '${valorRFC}'', function (err, result, fields) {
if (result.length > 0) {
app.get('/bd/', (req, res)=>{
res.json("jeje");
});
} else {
console.log("No login");
}
});
}
This result is from my JavaScript file with the following fetch:
if(response.context.rfc){
fetch('/bd/').then(r => r.json())
.then(data => {
console.log(data);
}).catch(err => {
});
}
};
But I get the following error in the JavaScript console:
script.js: 33 GET link 404 (Not Found)
Do you know how I can fix it?