DEV Community

Discussion on: Build a RESTful API with the Serverless Framework

 
mshaikhcci profile image
Thread Thread
 
mshaikhcci profile image
Mubina Shaikh
Thread Thread
 
mshaikhcci profile image
Mubina Shaikh

Also, I tried to debug by putting console statements in index.js file API's but console statements are not printed in BE.

app.get('/pokemon/', (req, res) => {
const query = 'SELECT * FROM pokemon_tb'
pool.query(query, (err, results, fields) => {
if (err) {
const response = { data: null, message: err.message, }
console.log('***********', response);
res.send(response)
}

    const pokemons = [...results]
    const response = {
        data: pokemons,
        message: 'All pokemons successfully retrieved.',
    }
    res.send(response)
})

})

please tell me why ?

Thread Thread
 
sagar profile image
Sagar

IDK exact reason behind this. you need crosscheck function with the article mention code blocks and also you've to debug the root cause of this.

Thread Thread
 
mshaikhcci profile image
Mubina Shaikh

Hi, i had crossed checked function code blocks with article code blocks, its the same.
Can please tell me why console statements arent printing, it should print right ?