Created
October 2, 2015 18:53
-
-
Save trendsetter37/f17c579ecf5e511c5b5f to your computer and use it in GitHub Desktop.
Getting Client IP in CoffeeScript
This file contains 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
http.get { host: 'checkip.dyndns.org' }, (res) -> | |
data = '' | |
res.on 'data', (chunk) -> | |
data += chunk.toString() | |
res.on 'end', () -> | |
console.log data.match(/([0-9]+\.){3}[0-9]+/)[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment