Monday, 2 July 2018

Chaining Promises

Hey all,I have a, hopefully, easy question. I'm pretty new to node and am wondering what the best way is to chain promises together. Let's say I have 4 tasks, but each task is sort of dependent on the previous. Suppose the tasks are 1, 2, 3, and 4. I've made this work by doing the following:1.then(() => stuff; 2.then( () => stuff; 3.then(() => stuff; 4.then(() stuff; return everything;)))).catch((err) => err);This works, but seems a little...sloppy. Is there a better way to do something like this? I think I just need someone to point me to some documentation to read. Thanks!

Submitted July 03, 2018 at 03:15AM by burbankmarc

No comments:

Post a Comment