本文已被:浏览 1743次 下载 2265次
Received:July 26, 2016 Revised:August 25, 2016
Received:July 26, 2016 Revised:August 25, 2016
中文摘要: Node.js是目前非常火热的技术之一,它是运行在服务器端的JavaScript执行环境. Node.js借助JavaScript的事件驱动机制加上V8高性能引擎,使得编写高性能Web服务轻而易举. Node.js在处理异步问题时一般采用的是callback回调的方式,但callback回调的方式存在Callback Hell的问题,无论是阅读还是调试都很不方便,甚至无法获取代码的堆栈. 基于Node.js平台,采用Promise方式,编写了一套网络爬虫的应用,在编写过程中详细的描述了如何使用Promise方式处理异步回调问题.
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
文章编号: 中图分类号: 文献标志码:
基金项目:
引用文本:
邓森泉,杨海波.Promise方式实现Node.js应用的实践.计算机系统应用,2017,26(4):218-223
DENG Sen-Quan,YANG Hai-Bo.Web Application Based on Node.js in the Way of Promise.COMPUTER SYSTEMS APPLICATIONS,2017,26(4):218-223
邓森泉,杨海波.Promise方式实现Node.js应用的实践.计算机系统应用,2017,26(4):218-223
DENG Sen-Quan,YANG Hai-Bo.Web Application Based on Node.js in the Way of Promise.COMPUTER SYSTEMS APPLICATIONS,2017,26(4):218-223