JS
The Javascript package of the API.

Requirements

No requirements for using this package.

Installation

For Node.js, React.js & React Native:
1
npm i gre-geoip --save
Copied!
For browser:
1
<script src="https://cdn.jsdelivr.net/gh/gre-dev/[email protected]/gre-geoip.min.js"></script>
Copied!

Importing the package

For Node.js, React.js & React Native:
1
const GREGeoIP = require('gre-geoip');
2
const GeoIP = new GREGeoIP('<API-Key>');
Copied!
For browser:
1
<script>
2
const GeoIP = new GREGeoIP('<API-Key>');
3
</script>
Copied!
DO NOT forget to replace <API-Key> with your own API Key. If you don't have one, please check out the Quick Start page.

Methods & Usage

After importing and defining the package you're ready now to use all it's functionalities. The library is consist or 3 main methods and each method returns a Promise. So, you can use .then() and .catch() with them.