Open shahenazmonia opened 5 years ago
It would be better if you put database query in a seprate file
const onLoad = (request, response) =>{ //get data from the database dbConnection.query('SELECT * FROM tododb', (err, result) => { if (err) { console.log("Error") console.log(err); } else { console.log(result); response.writeHead(200, {"content-type":"application/json"}) response.end(JSON.stringify(result.rows)); } });
It would be better if you put database query in a seprate file