Requirements
No requirements for using this package.
Installation
For Node.js, React.js & React Native:
npm i gre-geoip --save
or
yarn add gre-geoip
For Browser:
<script src="https://cdn.jsdelivr.net/gh/gre-dev/GeoIP-JS@latest/gre-geoip.min.js"></script>
Usage
Let's say that we want to get the visitor IP Address. So we do the following:
For Node.js, React.js & React Native:
const GREGeoIP = require('gre-geoip');
const GeoIP = new GREGeoIP('<API-Key>');
GeoIP.geoip({}).then(res => {
console.log(res?.data?.ip);
});
For Browser:
<script>
const GeoIP = new GREGeoIP('<API-Key>');
GeoIP.geoip({}).then(res => {
console.log(res?.data?.ip);
});
</script>
Options, Methods and More
You can find the full guide of this package by visiting our Documentation Page.
Credits
License
The MIT License (MIT). Please see License File for more information.