Skip to content

Commit 113f0c9

Browse files
committed
Output local IP Address.
Useful for connect devices and debug views
1 parent 6d86d85 commit 113f0c9

File tree

2 files changed

+30
-15
lines changed

2 files changed

+30
-15
lines changed

package.json

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,38 @@
11
{
22
"name": "react-toolbox-example",
3-
"version": "0.11.4",
43
"description": "A set of complementary tools to ReactJS.",
5-
"author": "React Toolbox Team (http://github.com/react-toolbox)",
4+
"version": "0.11.4",
5+
"author": {
6+
"name": "React Toolbox Team",
7+
"url": "http://github.com/react-toolbox"
8+
},
69
"contributors": [
710
{
811
"name": "Javi Jimenez Villar",
9-
"url": "http://soyjavi.com/",
10-
"email": "javi.jimenez.villar@gmail.com"
12+
"email": "javi.jimenez.villar@gmail.com",
13+
"url": "http://soyjavi.com/"
1114
},
1215
{
1316
"name": "Javi Velasco Arjona",
14-
"url": "http://javivelasco.com/",
15-
"email": "javier.velasco86@gmail.com"
17+
"email": "javier.velasco86@gmail.com",
18+
"url": "http://javivelasco.com/"
1619
}
1720
],
21+
"repository": {
22+
"type": "git",
23+
"url": "git+https://github.com/react-toolbox/react-toolbox-example.git"
24+
},
1825
"bugs": {
1926
"url": "https://github.com/react-toolbox/react-toolbox/issues",
2027
"email": "[email protected]"
2128
},
2229
"keywords": [
30+
"components",
31+
"material design",
2332
"react",
2433
"react-component",
25-
"material design",
26-
"toolbox",
27-
"components"
34+
"toolbox"
2835
],
29-
"license": "MIT",
3036
"devDependencies": {
3137
"autoprefixer": "6.3.6",
3238
"babel-core": "6.9.1",
@@ -44,6 +50,7 @@
4450
"eslint-plugin-react": "^5.1.1",
4551
"express": "^4.13.3",
4652
"extract-text-webpack-plugin": "1.0.1",
53+
"internal-ip": "~1.2.0",
4754
"node-sass": "3.7.0",
4855
"normalize.css": "^4.0.0",
4956
"postcss-loader": "0.9.1",
@@ -63,9 +70,10 @@
6370
"webpack-hot-middleware": "2.10.0"
6471
},
6572
"scripts": {
66-
"start": "node ./server",
6773
"build": "cross-env NODE_ENV=production UV_THREADPOOL_SIZE=100 webpack --config ./webpack.config",
68-
"deploy": "gh-pages -d build"
74+
"deploy": "gh-pages -d build",
75+
"start": "node ./server"
6976
},
70-
"repository": "github:react-toolbox/react-toolbox-example"
77+
"license": "MIT",
78+
"homepage": "https://github.com/react-toolbox/react-toolbox-example#readme"
7179
}

server.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const path = require('path');
22
const express = require('express');
33
const webpack = require('webpack');
4+
const internalIp = require('internal-ip');
45
const config = require('./webpack.config');
56

67
const app = express();
@@ -20,11 +21,17 @@ app.get('*', (req, res) => {
2021
res.sendFile(path.join(__dirname, './www/index.html'));
2122
});
2223

23-
app.listen(8080, '0.0.0.0', (err) => {
24+
const port = 8080;
25+
const ip = internalIp.v4();
26+
27+
app.listen(port, (err) => {
2428
if (err) {
2529
console.log(err);
2630
return;
2731
}
2832

29-
console.log('Listening at http://0.0.0.0:8080');
33+
console.log(' --------------------------------------');
34+
console.log(` Local: http://0.0.0.0:${port}`);
35+
console.log(` External: http://${ip}:${port}`);
36+
console.log(' --------------------------------------');
3037
});

0 commit comments

Comments
 (0)