diff --git a/node.js b/node.js new file mode 100644 index 0000000..c707823 --- /dev/null +++ b/node.js @@ -0,0 +1,90 @@ +const express = require('express'); +const expressip = require('express-ip'); + +const app = express(); +const PORT = 80; + +app.use(expressip().getIpInfoMiddleware); +app.set("PORT", PORT); + +app.get('/', function(req, res) { + const ipInfo = req.ipInfo; + console.log(req.ipInfo) + const range = `${req.ipInfo.range[0]} to ${req.ipInfo.range[1]}` + const ll = `${req.ipInfo.ll[0]} and ${req.ipInfo.ll[1]}` + + res.send(` + + + +Your IP Info + + + + + + + +
+


+

Your IP Information:

+

+ +
+

πŸ“‘ IP Info

+

+

πŸ”— IP: ${req.ipInfo.ip || "IP could not be displayed"}

+
+

β†ͺ️ Range: ${range || "Range could not be displayed"}

+
+

🌎 Country: ${req.ipInfo.country || "Country could not be displayed"}

+
+

πŸ—ΊοΈ Region: ${req.ipInfo.region || "Region could not be displayed"}

+
+

⏲️ Timezone: ${req.ipInfo.timezone || "Timezone could not be displayed"}

+
+

πŸŒ† City: ${req.ipInfo.city || "City could not be displayed"}

+
+

πŸ“ Coordinates: ${ll || "Coordinates could not be displayed"}

+
+

🌐 Metro: ${req.ipInfo.metro}

+
+

🚧 Area: ${req.ipInfo.area}

+
+
+ + +`); + +}); + +app.listen(app.get('PORT'), function() { + console.log(`Application started with port ${PORT}`) + console.log(`Any Info that appears here means someone (can be you too) clicked onto your web app.`) +});