IP Geolocation

Demo Link

  1. Create a route /visitors that displays the google map of where your visitors are and a list of the cities and the count of visits to this page.
  2. Create a route /api/visitors that sends back a JSON of all the visitors that have visited your site.
  3. Make sure to use x-forwarded-for headers!

Use the following API to get an estimate of where the user is coming from:
https://js5.c0d3.com/location/api/ip/<Replace with an IP address you want to look up>

To send a request from your server, you need to use a fetch library like node-fetch

If you do not want to spend money creating your own Google Maps API key, use ours! Right the source code of the demo site and then copy the script from the code into your own project:

<script src="https://maps.googleapis.com....></script>