Am trying to get data using postman but am getting handler method did not return a value yet i can console.log results. What might be the problem with my code?
{
method: 'GET',
path: '/departments',
handler: (request, h) => {
// let results=[];
connection.query('SELECT * FROM departments', function (Error, results) {
if (Error) {
console.log(Error);
return Error;
}
console.log(JSON.stringify(results));
});
return h.response(results);
}
}