dwyl / learn-postgresql

🐘 Learn how to use PostgreSQL and Structured Query Language (SQL) to store and query your relational data. 🔍
212 stars 23 forks source link

TypeError: Cannot read property 'id' of undefined result.rows[0].id ... #66

Open nelsonic opened 5 years ago

nelsonic commented 5 years ago

Obviously node.js dies irrecoverably at the first sign of a TypeError: image

So apparently we need to wrap the result of returned by the db.query in an if check. 🙄