When the need for LAN access in a static page, you can open the http-server to be accessed
When the need for LAN access in a static page, you can open the http-server to be accessed
1. This environment is based on node environment, you must first install node.js
First open a command line mode, enter
node -v
if the version number is displayed, it indicates that the installation is complete. If you do not have this command prompt, install node.js, the official website link node.js official website for installation.
2. If the previous step is completed, the next node in the command line Qiaoxia npm install http-server -g
after the transport: If you look at the command prompt, the installation is successful
3. Go to the directory you need to access the LAN, knocking hs
command or http-server appears port access, a copy of which can be accessed
http://127.0.0.1:8080
http://192.168.1.204:8080
This machine can access, mobile phone, or other device, use 192ip, must be in the same local area network;
4. http-server port http://127.0.0.1:8080/ browser, failed to timely feedback web page html, js file changes. This is because the browser will save some of the data, the next convenient time to load faster speed, but when we made some changes to the html / js, the browser can not take immediate effect, still before loading the page.
Then you need to clear the cache on your browser. Solution: Enter the following command line when the terminal is turned on http-server
http-server -c-1