The background,
At work, the following scenarios are often encountered: for example, the newly typed installation package and other files need to be temporarily sent to colleagues, and may need to be sent to multiple colleagues. At this time, we often have the following schemes:
1. Generally, there is an internal file system in the company, and the corresponding address will be sent to colleagues after the file is uploaded, but it usually involves many restrictions such as permissions, and they have to upload every time.
2. Upload it to the Internet and then send the corresponding link to colleagues, but this may inadvertently involve many problems such as security and speed limit, which is quite troublesome.
3, through the internal IM tool or QQ and other external IM tools timely send, in the face of several people or need to update the situation is more troublesome.
Recently chatting with colleagues at my front office, I found that there is a very easy way to solve this problem in such scenarios by directly setting up local static file services in a few steps. Find it useful, write Mark.
Ii. Construction process
2.1 installation nodejs
Nodejs is now quite sophisticated and can be downloaded and installed directly from the official website. After the installation is complete, verify that the installation is complete.
➜ ~ node -v
v10.16.3
Copy the code
2.2 installation anywhere
➜ ~ npm install anywhere -g
Copy the code
2.3 use anywhere
➜ ~ anywhere -- helpCopy the code
Output:
Usage:
anywhere --help // print help information
anywhere // 8000 as default port, current folder as root
anywhere 8888 // 8888 as port
anywhere -p 8989 // 8989 as port
anywhere -s // don't open browser anywhere -h localhost // localhost as hostname anywhere -d /home // /home as root anywhere -l // print log anywhere -f // Enable history fallbackCopy the code
2.4 Start Anywhere in a specified directory
➜ ~ cdLocalserver ➜ localserver anywhereCopy the code
The output
Running at http://172.22.70.44:8000/
Also running at https://172.22.70.44:8001/
Copy the code
The service is started successfully.
2.5 access
http://172.22.70.44:8000/ can access to your computer localserver all resource files in the directory.
Click to download directly, and within the LAN, the download speed is very impressive.
Three, endnotes
Nodejs Anywhere to build local static resource services, from the past to build local services in the complex process, especially for the server side is not familiar with the front-end or terminal development, in the face of temporary static files and other needs to share very convenient.
A few steps of operation, very convenient. Try this scenario.