U
U
urajo2019-11-18 13:16:57
Node.js
urajo, 2019-11-18 13:16:57

How to sequentially execute functions from a get call?

var pndli = [];
app.get('/',(request,response)=>{
  pndlist.findAll({raw: true}).then(pndlist=>{
    pndli = pndlist;
  }).catch(err=>console.log(err));
  response.render('index',{
    arr: pndli
  });
  console.log(pndli);
});

It is necessary that the array is first overwritten, and then rendering and output to the console are already performed. Now, as I understand it, it first displays everything, and then the request?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question