JavaScript: The Definitive Guide, Sixth Editio javaScript权威指南(第6版) pdf 文字版-文字版, javascript电子书, 和javascript 有关的电子书:

CHAPTER 12 Server-Side JavaScript


Server-Side JavaScript

The previous chapters have covered the core JavaScript language in detail, and we’re about to start Part II of the book, which explains how JavaScript is embedded in web browsers and covers the sprawling client-side JavaScript API. JavaScript is the programming language of the Web, and most JavaScript code is written for web browsers. But JavaScript is a fast and capable general-purpose language, and there is no reason that JavaScript cannot be used for other programming tasks. So before we transition to client-side JavaScript, we’ll take a quick look at two other JavaScript embeddings. Rhino is a Java-based JavaScript interpreter that gives JavaScript programs access to the entire Java API. Rhino is covered in §12.1 . Node is a version of Google’s V8 JavaScript interpreter with low-level bindings for the POSIX (Unix) API—files, processes, streams, sockets, and so on—and a particular emphasis on asynchronous I/O, networking, and HTTP. Node is covered in §12.2 .

The title of this chapter says that it is about “server-side” JavaScript, and Node and Rhino are both commonly used to create or to script servers. But the phrase “server-side” can also be taken to mean “anything outside of the web browser.” Rhino programs can create graphical UIs with Java’s Swing framework. And Node can run JavaScript programs that manipulate files the way shell scripts do.

This is a short chapter, intended only to highlight some of the ways that JavaScript can be used outside of web browsers. It does not attempt to cover Rhino or Node comprehensively, and the APIs discussed here are not covered in the reference section. Obviously, this chapter cannot document the Java platform or the POSIX API, so the section on Rhino assumes some familiarity with Java and the section on Node assumes some familiarity with low-level Unix APIs.

友情链接It题库(| 版权归yishouce.com所有| 友链等可联系|粤ICP备16001685号-1