【发布时间】:2018-01-24 16:43:35
【问题描述】:
我的回调地狱路线运行良好...
var myCallbackHell = router.route('/');
myCallbackHell.get(function(req, res, next) {
bookModel.find({title: "Animal Farm"}).then(function(book) {
movieModel.find({title: "Intouchables"}).then(function(movie) {
gameModel.find({title: "The Last of Us"}).then(function(game) {
res.render('index', {book_found: book, movie_found: movie, game_found: game});
});
});
});
});
但是我想使用 Promise。任何帮助,提示?
【问题讨论】:
-
不仅仅是回调地狱,您的代码看起来更像是一个承诺地狱。
标签: javascript callback promise