In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how vscode builds a local server. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
First, install Node
Second, install express
Open the terminal and enter the following code:
/ / Global installation npm install express-g / / Test whether the installation of express- hash is successful / if there is a problem, run npm install express-generator-g
Create a project folder
(1) steps:
1 、 express myapp
2 、 cd myapp
3 、 npm install
The instructions of the above steps: first create the project folder myapp, enter the folder, and initialize the project.
(2) composition of express framework
Description:
Bin is the startup file of the project. Configure how to start the project. Default npm start, in which the www file is used to start the service.
Node_modules is the module required for the file.
Public is the static file of the project, placing js, css, img, and so on.
Routes is the routing information file of the project, which controls address routing.
Views is a view file, placing template files such as ejs or jade (which is actually equivalent to a html file)
The above is the MVC framework pattern based on express, which is the basic component of a Web project.
IV. Operation
Enter the terminal in vsCode: node. / bin/www to start the service.
Note: the path node. / bin/ www` is different when you install it in the package.json file.
Accessing localhost:3000 in the browser shows the effect shown in the following figure, indicating that the startup is successful:
Note: the 3000 port number is in the www file under the bin file
Thank you for reading! This is the end of the article on "how to build a local server in vscode". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.