Reputation: 187
so i'm going through this app i did the api request succesfully but in my table i have more than one record and the query returns me only the first column
router.get('/OnePost', (req,res)=>{
jwt.verify(req.token, 'configSecret', (err, authData) => {
if(err) {
res.sendStatus(403);
} else {
const sql = "SELECT * FROM blog WHERE userid = $1";
const value = [authData.ID] ;
connection.query(sql,value)
.then(response => res.json(response.rows[0]))
.catch(e => console.error(e.stack))
}
})
})
Upvotes: 1
Views: 341