I. Variable pollution
The global variables and functions in JS are overwritten
Two. node. JS Specification
Node application is made up of modules, using the COMMONJS module specification
Three. COMMONJS specification
1. Each file is a module with its own scope, defined in this file is private, other files are not visible
2. Use the Require method to load other modules
3. Within each module there is a module variable, which is an object whose exports attribute is the only interface to the external (module.exports)
Four. Commonjs Module features
1. All code runs at the module scope and does not pollute the global scope
2. The module can be loaded multiple times, but only run once at the first load, then run the result is cached, and then load, directly read the cache results, to let the module run again, it must be clearly cached
3. The order in which the modules are loaded, in the order in which they appear in the code
Five. Req/res in the route
Request: Requests (This object has all the data for this request)
Response: Response (This object can respond to the browser)
Res.send () responds some data (string/object) to the browser
Req.body getting the parameters of the POST request
Res.redirect () redirect Browser Web page (lets browser jump)
node. js