Article directory
Target
I wrote a web page that needs to be tested on the mobile side.
The PC and the mobile phone are under the same WIFI.
serve
is an npm package to quickly start a static server.
Simple to use
Prepare an index.html:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
name="viewport">
<meta content="ie=edge" http-equiv="X-UA-Compatible">
<title>Document</title>
</head>
<body>
<h1>你好,世界!</h1>
</body>
</html>
Start the server:
npx serve
Effect:
The first is the address accessed by the machine.
The second is the address accessed within the LAN.
PC edge:
Mobile:
Is it possible to use any server?
To this end, I built another parcel project.
The port is 1234.
PC edge:
Mobile terminal: The IP remains unchanged, but the port number is changed.
It seems possible.
How to get this IP address?
Command Line:
ipconfig
Find: IPv4 address.
What about the Internet?
The simple way is to open a hotspot and convert it into an intranet.
What else can I do with this function?
Local area network file transfer, no internet required.