BETA
My accountGet started
May 122017
Total.js Platform

Geolocation in Total.js

How to use Geolocation in Total.js framework? Localize each IP address in your web application.

Geolocation in Total.js

  • this tutorial uses a middleware
  • obtained data will be stored in req.geolocation variable
  • this tutorial extends Controller by adding geolocation() method which returns req.geolocation

Create a definition file e.g. geolocation.js:

Usage

Now we extend routes where we want to use Geolocation.

Result:

Tips

  • we can use a global middleware via F.use('geolocation', '*', ['web']);
  • we can store geolocation data in cookies or in a database