Skip to content

Instantly share code, notes, and snippets.

@antoniolazaro
Created August 28, 2019 12:19
Show Gist options
  • Save antoniolazaro/e109b6f3116f7e67999d942e18662967 to your computer and use it in GitHub Desktop.
Save antoniolazaro/e109b6f3116f7e67999d942e18662967 to your computer and use it in GitHub Desktop.
Empty JS
const getAllCategories = (request, response) => {
pool.query('SELECT id,name FROM category ORDER BY name ASC', (error, results) => {
console.log('vai processar query')
if (error) {
throw error
}
console.log('processou query')
console.log(results.rows)
response.status(200).json(results.rows)
})
}
server.get('/categorias',(req, res, next) => {
console.log('vai processar')
console.log(categoryDatabase.getAllCategories(req,res))
res.send(categoryDatabase.getAllCategories)
next()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment