DELETE

PHOTO EMBED

Wed Jun 23 2021 15:11:41 GMT+0000 (Coordinated Universal Time)

Saved by @joeavargas

// DELETE (Delete)
app.delete('/api/delete/:id', (req, res) =>{

    (async () => {

        try{
            const document = db.collection('products').doc(req.params.id);
            await document.delete();
          // Successfully deleted document
            return res.status(200).send(response);
        }
        catch(error){
          // Handle error
            console.log(error);
            return res.status(500).send(error);
        }
    })();
});
content_copyCOPY