How do I avoid deeply nested code in node.js?

后端 未结 6 2174
执念已碎
执念已碎 2021-02-08 22:28

In node.js, it being event-driven, all I/O is done via callbacks. So I end up writing code that looks like this:

app.get(\'/test\', function (req, res) {
  ht         


        
6条回答
  •  孤独总比滥情好
    2021-02-08 23:15

    Please have a look at Streamline; it is a JavaScript preprocessor that allows you to write simple 'streamlined' code and transforms it to callback-heavy code.

提交回复
热议问题