JS
The Javascript package of the API.

Requirements

No requirements for using this package.

Installation

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

Importing the package

For Node.js, React.js & React Native:
const GREGeoIP = require('gre-geoip');
const GeoIP = new GREGeoIP('<API-Key>');
For browser:
<script>
const GeoIP = new GREGeoIP('<API-Key>');
</script>
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.
Copy link
On this page
Requirements
Installation
Importing the package
Methods & Usage