Preview:
// GET - ALL DATA
app.get('/api/read', (req, res) =>{

    (async () => {

        try{
            let query = db.collection('products');
            let response = [];

            await query.get().then(querySnapshot => {
                let docs = querySnapshot.docs; // result of the query

                for (let doc of docs){
                    const selectedItem = {
                        id: doc.id,
                        name: doc.data().name,
                        description: doc.data().description,
                        price: doc.data().price
                    };
                    response.push(selectedItem);
                }
                return response; // each then should return a value
            })
          // Successfully queried data
            return res.status(200).send(response);
        }
        catch(error){
          // Handle error
            console.log(error);
            return res.status(500).send(error);
        }
    })();
}); 
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter