首页 | 本学科首页   官方微博 | 高级检索  
     

Promise方式实现Node.js应用的实践
引用本文:邓森泉,杨海波. Promise方式实现Node.js应用的实践[J]. 计算机系统应用, 2017, 26(4): 218-223
作者姓名:邓森泉  杨海波
作者单位:中国科学院 沈阳计算技术研究所, 沈阳 110168;中国科学院大学, 北京 100049,中国科学院 沈阳计算技术研究所, 沈阳 110168
摘    要:Node.js是目前非常火热的技术之一,它是运行在服务器端的JavaScript执行环境. Node.js借助JavaScript的事件驱动机制加上V8高性能引擎,使得编写高性能Web服务轻而易举. Node.js在处理异步问题时一般采用的是callback回调的方式,但callback回调的方式存在Callback Hell的问题,无论是阅读还是调试都很不方便,甚至无法获取代码的堆栈. 基于Node.js平台,采用Promise方式,编写了一套网络爬虫的应用,在编写过程中详细的描述了如何使用Promise方式处理异步回调问题.

关 键 词:Node.js  Promise  Web应用
收稿时间:2016-07-26
修稿时间:2016-08-25

Web Application Based on Node.js in the Way of Promise
DENG Sen-Quan and YANG Hai-Bo. Web Application Based on Node.js in the Way of Promise[J]. Computer Systems& Applications, 2017, 26(4): 218-223
Authors:DENG Sen-Quan and YANG Hai-Bo
Affiliation:Shenyang Institute of Computing Technology, Chinese Academy of Sciences, Shenyang 110168, China;University of Chinese Academy of Sciences, Beijing 100049, China and Shenyang Institute of Computing Technology, Chinese Academy of Sciences, Shenyang 110168, China
Abstract:Node.js is one of the most popular technologies at present, and it is the JavaScript execution environment running on the server. With event-driven mechanism Node.js JavaScript plus high-performance V8 engine, it''s easy to achieve high-performance Web services. When Node.js deals with the problem of asynchronous, it generally uses callback method, but there are Callback Hell problems in the way of callback. Whether reading or debugging is very inconvenient, it is even impossible to get the code stack. Based on Node.js platform, using Promise method, we realize a Web crawler application. We describe in detail how to use the Promise approach to deal with the problem of asynchronous callback during the application process.
Keywords:Node.js  Promise  Web application
点击此处可从《计算机系统应用》浏览原始摘要信息
点击此处可从《计算机系统应用》下载全文
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号