`
leonzhx
  • 浏览: 763105 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Chapter 1. A Very Brief Introduction to Node.js

阅读更多

1. Node is a wrapper around the high-performance V8 JavaScript runtime from the Google Chrome browser. Node tunes V8 to work better in contexts other than the browser, mostly by providing additional APIs that are optimized for specific use cases.

 

2. In a server context, manipulation of binary data is often necessary. This is poorly supported by the JavaScript language and, as a result, V8. Node’s Buffer class provides easy manipulation of binary data. 

 

3. Using an architecture called an event loop, Node makes programming highly scalable servers both easy and safe. 

 

4. To support the event-loop approach, Node supplies a set of “nonblocking” libraries. In essence, these are interfaces to things such as the filesystem or databases, which operate in an event-driven way.

 

5. Although not unique to Node, supporting JavaScript on the server is also a powerful feature.

 

6. Node is extremely extensible, with a large volume of community modules.

 

7. Node.js is available from two primary locations: the project’s website or the GitHub repository. You’re probably better off with the Node website because it contains the stable releases.

 

8. Node.js version numbers follow the C convention of major.minor.patch. Stable versions of Node.js have an even minor version number, and development versions have an odd minor version number.

 

9. Node REPL (“Read-Evaluate-Print-Loop”), an interactive Node.js programming environment. You can start Node REPL by running node binary without any argument.  It offers meta-commands, which all start with a period (.). Thus, .help shows the help menu, .clear clears the current context, and .exit quits Node REPL. .clear wipes out any variables or closures you have in memory without the need to restart REPL.

 

10. Simply typing the name of a variable in Node will enumerate it in the shell. Node tries to do this intelligently so a complex object won’t just be represented as a simple Object, but through a description that reflects what’s in the object.

 

11. Although the V8 runtime is used in Node.js to interpret the JavaScript, Node.js also uses a number of highly optimized libraries to make the server efficient. In particular, the HTTP module was written from scratch in C to provide a very fast nonblocking implementation of HTTP.

 

12. Node REPL uses ... to indicate that you haven’t completed the statement and should continue entering it. 

 

13. console.log simply prints information to stdout, much like the browser counterpart supported by Firebug and Web Inspector.

 

14. Node introduces the architecture called event-driven computing to the programming space for web servers. 

 

15. People such as Douglas Crockford, Dion Almaer, Peter Paul Koch (PPK), John Resig, Alex Russell, Thomas Fuchs, and many more have provided research, advice, tools, and primarily libraries that have allowed thousands of professional JavaScript programmers worldwide to practice their trade with a spirit of excellence.

 

16. Libraries such as jQuery, YUI, Dojo, Prototype, Mootools, Sencha, and many others are now used daily by thousands of people and deployed on millions of websites.

 

17. Each browser has its own JavaScript runtime: Spider Monkey for Firefox, Squirrel Fish Extreme for Safari, Karakan for Opera, and finally V8 for Chrome.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics