Skip to content

Instantly share code, notes, and snippets.

View KellynCodes's full-sized avatar

Kelechi Amos KellynCodes

View GitHub Profile
@KellynCodes
KellynCodes / JavaScript
Last active September 27, 2022 22:21
How to get users IP address on Express Js
const express = require('express');
const app = express();
app.get('/',function(req, response) {
const ipAddress = req.header('x-forwarded-for') ||
req.socket.remoteAddress;
res.send(ipAddress);
});
@KellynCodes
KellynCodes / JavaScript
Created September 27, 2022 22:18
How to get users IP address on Express Js
const express = require('express');
const app = express();
app.get('/',function(req, response) {
const ipAddress = req.header('x-forwarded-for') ||
req.socket.remoteAddress;
res.send(ipAddress);
});