-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add examples for
internalIP
and internalIPSync
- Loading branch information
Showing
4 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# internalIPSync(family: "v4" | "v6") | ||
|
||
Returns the internal IP address synchronously. | ||
|
||
```js | ||
const WebpackDevServer = require("webpack-dev-server"); | ||
|
||
const localIPv4 = WebpackDevServer.internalIPSync("v4"); | ||
const localIPv6 = WebpackDevServer.internalIPSync("v6"); | ||
|
||
console.log("Local IPv4 address:", localIPv4); | ||
console.log("Local IPv6 address:", localIPv6); | ||
``` | ||
|
||
Use the following command to run this example: | ||
|
||
```console | ||
node app.js | ||
``` | ||
|
||
## What Should Happen | ||
|
||
- The script should log your local IPv4 and IPv6 address. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
"use strict"; | ||
|
||
const WebpackDevServer = require("../../../lib/Server"); | ||
|
||
const localIPv4 = WebpackDevServer.internalIPSync("v4"); | ||
const localIPv6 = WebpackDevServer.internalIPSync("v6"); | ||
|
||
console.log("Local IPv4 address:", localIPv4); | ||
console.log("Local IPv6 address:", localIPv6); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# internalIP(family: "v4" | "v6") | ||
|
||
Returns the internal IP address asynchronously. | ||
|
||
```js | ||
const WebpackDevServer = require("webpack-dev-server"); | ||
|
||
const logInternalIPs = async () => { | ||
const localIPv4 = await WebpackDevServer.internalIP("v4"); | ||
const localIPv6 = await WebpackDevServer.internalIP("v6"); | ||
|
||
console.log("Local IPv4 address:", localIPv4); | ||
console.log("Local IPv6 address:", localIPv6); | ||
}; | ||
|
||
logInternalIPs(); | ||
``` | ||
|
||
Use the following command to run this example: | ||
|
||
```console | ||
node app.js | ||
``` | ||
|
||
## What Should Happen | ||
|
||
- The script should log your local IPv4 and IPv6 address. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"use strict"; | ||
|
||
const WebpackDevServer = require("../../../lib/Server"); | ||
|
||
const logInternalIPs = async () => { | ||
const localIPv4 = await WebpackDevServer.internalIP("v4"); | ||
const localIPv6 = await WebpackDevServer.internalIP("v6"); | ||
|
||
console.log("Local IPv4 address:", localIPv4); | ||
console.log("Local IPv6 address:", localIPv6); | ||
}; | ||
|
||
logInternalIPs(); |