Lets say someone is pinging my site, is there a way to see the ips/requests?
const express = require("express");
const app = express();
app.get("*", (req, res, next) => {
const IP = req.headers["x-forwarded-for"].split(",")[0];
console.log(IP); // logs the ip in server console
next()
});
app.listen(3000);
4 Likes