I'm trying to learn the pg-promise library and i need to get a url in the db from a parameter from the client. I got it working where the code finds the data but when i display the data object it just showsgot url: [object Object] how do i get it to display the actual data retrieved?app.get('/:aID', function(req, res){ let query = "select url from theurls where id=\'"+req.params.aID+"\'" db.result(query) .then(function(data){ console.log('got url: ' + data) }) .catch(function(error){ console.log('url doesn\'t exist: ' + error) }) })
Submitted April 02, 2016 at 07:28PM by audiodev
No comments:
Post a Comment