fac-12 / FAC-Events-Search

Event Finder Prototype
http://fac-eventfinder.herokuapp.com
3 stars 0 forks source link

mixture of promises and async #68

Open Jbarget opened 6 years ago

Jbarget commented 6 years ago

https://github.com/fac-12/FAC-Events-Search/blob/master/services/dbHelpers.js

Id recommend sticking with one asynchronous strategy. Either or, it doesn't matter too much but its unnecessary to have both

shannonjensen commented 6 years ago

await is built on promises, so that promise in dbHelpers is in the service of an await async function. They aren't two separate things. You need promises in order to use await async elsewhere. Obviously things like axios and pg-promise provide promises automatically but that is a custom promise.

We are always handling promises with await async rather than .then... except for in some db queries where its simpler to use promises' original syntax...