promises

NodeJs api with promises

I am developing an API in TypeScript with NodeJS and MariaDB; when I do an operation with the bank, just below I have a if t ... an API? What are the possible complications? What would be the disadvantages and advantages over this architecture in a API ?

What are promises in JavaScript?

Was searching about callback in JavaScript when I found this question: How to really learn how to use promises in javascript? But after all: What are promises? What are they for?

Difference between promise and callback

I would like to understand a little better the advantages of using Promise! Today I use callback function. Ex: function a( ... ); }, function(err) { console.log(err); }); I would like to know if functionally there are differences in the two models?

How to call the function again without losing the promise?

I'm a beginner still at Node.Js, and I don't know how to do this operation. In the code below to notice that the function rea ... res.indexOf("Nenhum post seguido foi atualizado.") != -1){ console.log("Não há atualizações!") } })

Difference between promise.then (sucess, error) and promise.then ().catch()?

Hello, I would like to clarify the difference and when to use each of the promise handling models: obj.promessa( parametr ... rn deffered.resolve("sucesso"); } else { return deferred.reject("error"); } return deferred.promise; } Hugs!

Update sweetalert 1.X for sweetalert 2 + javascript promises [closed]

Closed. this question is out of scope and is not currently accepting answers. ... like to know how I can transcribe the function using promisses, and know what the use of promisses improves on the function.

Promise node js

I make 3 https nodejs requests for an API also in node, each promise executes a task and these promises I am passing several ... nseJson.data.filter_value); } The id I want to pass to promise EXAMPLE_2 is in the variable idResp. Could someone guide me?

What are the differences between Promise.all () and Promise.allSettled ()?

I'm doing some tests with Promises and I found that there are two ways to get the result of a set of promises: Using Prom ... } What is the difference between the two? Do they both have the same compatibility? When should I use one or the other?

How do I return a value from a promise in Javascript?

Good I'm facing the following problem, I'm contributing on a mozilla extension, but most browser APIs use promises to get thi ... is that the way the code is promise can't handle functions that use return, if it wasn't for that it would have finished now.

Why do I need to pass two then on AJAX requests made with the fetch API?

In the example of the following request: fetch("https://viacep.com.br/ws/01001000/json/") .then(resposta => resposta.j ... fused. If in the first then I do not have this information, why would I have in the second if it is a callback of the first?

Resolve / reject do return role in javascript?

As mentioned in the title, the resolve and reject of a promise already "make role" of return or still yes (depending on the o ... work, though, I don't know if I should use return or not, if that would influence anything... Can anyone explain? Thank you!

How to make a chained promise with pure Javascript? [duplicate]

this question already has an answer here : ... ); promise.then(function (value) { console.log(value); }); }); console.log('finalizado');