I. Preface
1:node.js is essentially a JS run environment written in C + + using the Chrome browser V8 engine
2: Compared to JS no browser security restrictions, additional system-level API: File read and write, process management, network communications.
3: There are many projects completed with node. js, such as Appjs cross-platform desktop applications, the jade and node. JS Combination uses a convenient management background HTML template, grunt Automation tools, Express.js
4:nodejs.org,npmjs.com Module Community, Github,stackoverflow
5:gitbash: cmd-like, but can execute GIT commands, highlighted and packaged system commands are better than cmd
Two: examples
1: Official Website example
Const HTTP = require (' http '= ' 127.0.0.1 '=' = ' = ' http.createserver ' (req, res) + = { = $; Res.setheader (' content-type ', ' Text/plain '); Res.end (' Hello world\n '= { console.log (' Server running at http:// ${hostname}:${port}/');});
A Web server, only need to pass in an anonymous callback function, the server is created successfully, the code is not blocked, but continue to execute, this is the event-driven model of the programming style, in the Nodejs will be a lot of this way, Call this JS file on the command line and start listening.
Attack on node. JS Foundation (i)