Refer to the article

Blog.csdn.net/abc6368765/…

1. Pick a random folder

$ npm install express --save

Express application generator

You can quickly create an application skeleton by applying the generator tool Express-Generator. Express-generator includes the Express command line utility. Run the following command to install it:

$ npm install express-generator -g

3. Then install all dependencies

$ cd myapp

$ npm install

4, start,

$DEBUG=myapp:* NPM start or NPM run start

5. Open the browser (default is local port 3000)

6. Customize ports

App.js

process.env.PORT = 4000;

7, the rest of the interface to write what you see the reference article

8. Code address