Skip to content

see-u-better/ip-timezones

Repository files navigation

See-U-Better IP Timezones

Gives geolocation / timezone infos about an IP

Requirements

  • Node >=18
  • Download token from https://www.ip2location.com set in .env (DOWNLOAD_TOKEN)

Commands

  • yarn setup: Run post-install setup
  • yarn setup

Tests

  • yarn test

Usage

The API key should be set as the header X-Api-Key on every request.

  • yarn dev: Start the development watcher
  • yarn start: Start the server

The endpoints are the following :

IP details response

GET http://localhost:9393/api/ip/1.1.1.1
{
    data: {
        ip:             "1.1.1.1"
        ipNo:           "16843009"  // IP in decimal format
        countryShort:   "US"
        countryLong:    "United States of America"
        region:	        "California"
        city:           "San Jose"
        zipCode:        "95101"
        latitude:       37.33939
        longitude:      -121.894958
        timeZone:       "America/Los_Angeles"
    }
}

Timezones response

GET http://localhost:9393/api/timezone
{
    data: [
        {
            name            "Pacific/Midway"
            country_code    "UM"
            dst	            "0"      // Daylight Saving Time
            gmt_offset	    -39600   // Offset to GMT in seconds
        },
        ...,
        {
            name            "Europe/Paris"
            country_code    "FR"
            dst	            "1"
            gmt_offset	    7200
        },
        ...
    ]
}

Timezone details response

GET http://localhost:9393/api/timezone/Europe/Paris
{
    data: {
        name            "Europe/Paris"
        country_code    "FR"
        dst	            "1"
        gmt_offset	    7200
    },
}

About

Geolocation / Timezone infos API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published