PHP Development Technology Stack (LAMP) Linux Apache MySql php
node. JS full stack development technology stack (MEAN): MongoDB Express Angular node. js
Objectives of the current study:
- Understanding the server development process
- Uses node. js to develop a basic HTTP service program (Web application)
node. js
Characteristics:
1. Event-driven (when an event is triggered, execution passes past the callback function)
2. Non-blocking I/O model (does not block threads when I/O operations are performed)
3. Single Thread
A new Get concept: (you didn't see anything?) (? ??? Omega??? ?)? )
The meaning of configuring environment variables: When the command is entered in the console, if the input is not in the current directory, if the environment variable is set, then the system will be in the environment variable
Look for the folder where you entered the command until you find the appropriate path.
The difference between using a node. JS development site and a traditional development site:
Traditional Web site: Web container required
node. JS is developing: No Web container is required because node. JS is itself a Web server
Node's version manager nvm
Download NVM Address: https://github.com/coreybutler/nvm-windows/releases
NVM is used to manage multiple node versions on a single computer
- The NVM list is marked with an asterisk indicating the current
- NVM using node v8.4.0
- NVM Install Latest
- NVM Install version number
- NVM Uninstall version number
Exit the node environment
1. Exit
2. Hold down the CTRL key and press the C key twice
A section of JS code, write file operation
// Write file operation let FS = require (' fs '= ' Hello world! ' console.log (' Fs.writefile ') ('/hello.txt '), msg, ' UTF8 ',function(err) {
Console.log (' 111 ') // If the err===null indicates a successful write if (err) { Console.log (' Write file failed '); } Else { console.log (' Write file succeeded! '); });
Console.log (' 222 ')
Note that the require () function is used above, and the function of the require () function is to load the FS module
Another process module (for a chestnut) does not need to be loaded with the Require () function
Cause: The process module is a global module, FS is not a global module, and the global module can be used directly
Non-global modules require the Require () function to load
Determine if the require () function is required to load
1. Open the node document directly to see the appropriate function
2. The left column of the document has the Globals module, which can be viewed directly
In addition, in the above code, there are several output numbers of Console.log (), then what is the order of the output?
The answer is 000 222 111
The reason for this output is that the above WriteFile () function is executed asynchronously , and will not wait for the write to run after the code
node. JS Learning 01