Add internal ip to easily test other devices

old
Javi Velasco 2016-11-05 12:23:32 +01:00
parent e240cf237e
commit c3a614c05e
2 changed files with 10 additions and 2 deletions

View File

@ -67,6 +67,7 @@
"git-dirty": "~1.0.2",
"glob": "~7.1.1",
"immutability-helper": "~2.0.0",
"internal-ip": "~1.2.0",
"karma": "~1.3.0",
"karma-cli": "~1.0.0",
"karma-mocha": "~1.2.0",

View File

@ -1,6 +1,7 @@
const path = require('path');
const express = require('express');
const webpack = require('webpack');
const internalIp = require('internal-ip');
const config = require('./webpack.config.development');
const app = express();
@ -20,11 +21,17 @@ app.get('*', function (req, res) {
res.sendFile(path.join(__dirname, './spec/index.html'));
});
app.listen(8080, '0.0.0.0', function (err) {
const port = 8080;
const ip = internalIp.v4();
app.listen(port, (err) => {
if (err) {
console.log(err);
return;
}
console.log('Listening at http://0.0.0.0:8080');
console.log(' --------------------------------------');
console.log(` Local: http://0.0.0.0:${port}`);
console.log(` External: http://${ip}:${port}`);
console.log(' --------------------------------------');
});