Nodejs - Using Promises For Api Calls
I have a nodeJS library, where I'm coding a certain functionality, which will call a SOAP API to get information. I want that people can use the library easily. So that they can ju
Solution 1:
Should I only use async for the actual async API call, or for the whole library function?
Yes - always promisify at the lowest level! You will want to use power of promises yourself, don't you?
The SOAP client might return a promise by itself already. So then I would have two promises floating around a function, and I'm not sure if that is a good idea at all really.
Indeed, wrapping a promise-returning call in another new Promise
call is an exceptionally bad idea even.
Post a Comment for "Nodejs - Using Promises For Api Calls"