Giter Site home page Giter Site logo

locate.now's Introduction

locate.now

A simple API for IP address & geolocation lookup.


Visit locate.now.sh for a live demo. Check out my blog and follow me on Twitter.


~ ❯❯❯ curl 'https://locate.now.sh/ip/json'
{"ip":"127.0.0.1"}


Usage

IP address lookup

Format:

https://locate.now.sh/ip/:type
API URI Type Sample Response
https://locate.now.sh/ip text 127.0.0.1
https://locate.now.sh/ip/json json {"ip":"127.0.0.1"}
https://locate.now.sh/ip/jsonp jsonp callback({"ip":"127.0.0.1"})
https://locate.now.sh/ip/jsonp/lookupip jsonp lookupip({"ip":"127.0.0.1"})

Examples:

~ ❯❯❯ curl https://locate.now.sh/ip
127.0.0.1

~ ❯❯❯ wget -qO- https://locate.now.sh/ip/json
{"ip":"127.0.0.1"}

Geolocation lookup

Format:

https://locate.now.sh/geo
API URI Type Sample Response
https://locate.now.sh/geo json {"range":[532553667,543523605],"country":"GB","region":"H8","city":"Liverpool","ll":[51.4157,-3],"metro":0,"zip":0}

Examples:

~ ❯❯❯ curl https://locate.now.sh/geo
{"range":[532553667,543523605],"country":"GB","region":"H8","city":"Liverpool","ll":[51.4157,-3],"metro":0,"zip":0}`

~ ❯❯❯ wget -qO- https://locate.now.sh/geo
{"range":[532553667,543523605],"country":"GB","region":"H8","city":"Liverpool","ll":[51.4157,-3],"metro":0,"zip":0}`

Installation & Configuration

Clone the repository and install all dependencies by running:

~ ❯❯❯ git clone https://github.com/apilayer/locate.now
~ ❯❯❯ cd locate.now/
~/locate.now ❯❯❯ npm install

Subsequently, create a .env file and declare a variable called SECRET (for session security purposes):

~/locate.now ❯❯❯ echo "SECRET=[your-secret-goes-here]" > .env
~/locate.now ❯❯❯ npm start

You can then access the service by navigating to localhost:3000.


Deployment

First, download now:

~ ❯❯❯ npm install -g now

Then, run now from within the directory of locate.now:

~/locate.now ❯❯❯ now

License

Copyright (c) 2018 by apilayer. Some rights reserved.

locate.now is under the terms of the MIT License, following all clarifications stated in the license file.

locate.now's People

Contributors

calvinalx avatar k4m4 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.