摘要
Node.js是目前非常火热的技术之一,它是运行在服务器端的JavaScript执行环境.Node.js借助JavaScript的事件驱动机制加上V8高性能引擎,使得编写高性能Web服务轻而易举.Node.js在处理异步问题时一般采用的是callback回调的方式,但callback回调的方式存在Callback Hell的问题,无论是阅读还是调试都很不方便,甚至无法获取代码的堆栈.基于Node.js平台,采用Promise方式,编写了一套网络爬虫的应用,在编写过程中详细的描述了如何使用Promise方式处理异步回调问题.
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.
出处
《计算机系统应用》
2017年第4期218-223,共6页
Computer Systems & Applications