From b031dcf9c7f3e2c45991c67c3f42b0067c6f31ce Mon Sep 17 00:00:00 2001 From: alexmorenograu <61759297+alexmorenograu@users.noreply.github.com> Date: Fri, 24 Sep 2021 08:10:40 +0200 Subject: [PATCH] test ipaddress --- package-lock.json | 5 +++++ package.json | 1 + server.js | 3 +++ 3 files changed, 9 insertions(+) diff --git a/package-lock.json b/package-lock.json index b5dfd23..9af0311 100644 --- a/package-lock.json +++ b/package-lock.json @@ -862,6 +862,11 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, + "ip": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" + }, "ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", diff --git a/package.json b/package.json index c1b6b94..cc6105c 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "eslint-config-google": "^0.14.0", "express": "^4.17.1", "got": "^11.8.2", + "ip": "^1.1.5", "mysql": "^2.18.1" } } diff --git a/server.js b/server.js index 93acf5c..b7ea7ed 100644 --- a/server.js +++ b/server.js @@ -1,5 +1,7 @@ const express = require('express'); const app = express(); +const ip = require('ip'); +const ipAddress = ip.address(); const port = 7777; const logIn = require('./methods/logIn'); const con = require('./db/connect'); @@ -16,4 +18,5 @@ app.use('/flashOn', require('./methods/flashOn')); app.listen(port, () => { console.info(`http://localhost:${port}`); + console.log(`Network access via: ${ipAddress}:${port}!`); });