Created
September 1, 2019 17:27
-
-
Save blubbll/05a3e9f9c54af1a45ccd451abf1c6588 to your computer and use it in GitHub Desktop.
nodejs get user ip
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.set('trust proxy', true) | |
app.get('/ip', (req, res) => { | |
console.log(req.ip); | |
res.send(req.ip); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment