javascript - NodeJS when to use promises? -


this might little opinion based, important question.

should use promises async operations? if have api, likely, full stack of functions in there should use promises. if make business logic functions, should return promise. wonder if good, make return promise. mean, i'm calling functions inside while loop, each of them returns promise (the functions chained). slower use promises inside function? idea in stack combine promises , regular return values? need learn this, please don't close

if function (sometimes) asynchronous, needs return promise.
if function never asynchronous, there's no reason return promise, , should avoid it. keep simple , synchronous.


Comments

Popular posts from this blog

cron - how to properly run Python script with crontab on every system startup -

elasticsearch - Is the order of operations guaranteed in a bulk update? -

Slow performance first queries on SQL Azure -