Skip to content
This repository has been archived by the owner on May 3, 2019. It is now read-only.
/ node-getmyip Public archive

Simple Node application returning the IP adress of the client

Notifications You must be signed in to change notification settings

carlptr/node-getmyip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

Node-GetMyIp

A simple Node application to return the IP of the client.

Feature

  • Return the IP of the client by using the client connection or by using the header x-forwarded-for in either plain text, JSON or JSONP format.

Installation

  1. Download application
  2. Extract zip to a new directory where you want the app to reside

Usage

$ node app.js [port]

Default port is 80. You can specify a different port as command line argument or by defining an environment variable PORT.

To retrieve the IP use one of the following methods depending on the desired format:

Format URL Example
Plain text http://your-server:[port] Example
JSON http://your-server:[port]/?format=json Example
JSONP http://your-server:[port]/?format=jsonp&jsonp=callback Example

The created JSON output looks like the following: {ip: '127.0.0.1'}

Try it out

About

Simple Node application returning the IP adress of the client

Resources

Stars

Watchers

Forks

Packages

No packages published