Introduction: In the Express framework from 3.x to 4.x, a large change, the main thing is to replace the middle of the library connect, instead of using more granular libraries instead. The benefit of this approach is that these middleware can be updated and released more freely, without being affected by the express release cycle. The problem with this, however, is that 4.x is not fully compatible with the previous 3.x version. Therefore, write a document to record the introductory document for Express 4.x.
Environment: Install Nodejs and NPM First, the process will not repeat.
Installation:
1. Express:
<1> Global Installation: NPM INSTALL-G Express (recommended)
<2> Local Installation: NPM install express-d
After the installation is complete, you can use: Express-v view version number
2. Express-generator:
<1> Global Installation: NPM install-g express-generator
<2> Local Installation: NPM install express-generator-d
3. Create a simple project instance using the Express-generator generator:
EXPRESS-E Framework
4. Install the basic middleware
CD Framework && NPM Install
5. Start
NPM start
6. Through http://server_ip:3000, the following pages are visible (Server_ip is the physical machine IP address where the node server resides)
At this point, the webserver of a simple Nodejs express framework is built.
NodeJs Express 4.x Getting Started