How to run a consolidation request in the console?

When I run a sequelize request in the console during a debugging session, the return is an unresolved promise. But how can I get the result of this query / promise instantly?

How am I doing this so far:

Author.findOne({})
      .then(function(error, result){
               debugger;
               //now I can work with the outcome in the console
            })

This approach is extremely time-consuming, simple changes to the request will require a repeat of the entire debugging session to see the new result.

+4
source share
1 answer

, Node , , , , JavaScript/ . , , . API . sequelize, .

REPL. node --inspect-brk Node Chrome dev ( chrome://inspect). sequelize, db, Author ( script, --inspect), :

await Author.findOne({})

, ( → ), / (copy(JSON.stringify(temp1))) .. .

+2

Source: https://habr.com/ru/post/1689125/


All Articles