CLI: npm install -g ipgeobase-greybutton
Module: npm install --save ipgeobase-greybutton
CLI: ipgeobase-greybutton 127.0.0.1
Module:
import ipgeobase from "ipgeobase-greybutton";
ipgeobase('127.0.0.1');
Services support: metaweather(default), openweathermap
CLI: npm install -g weather-greybutton
Module: npm install --save weather-greybutton
CLI: weather-greybutton --service openweathermap berlin
Module:
import Weather from "weather-greybutton";
const weather = new Weather(options);
const berlinWeather = weather.getDataByCity('berlin', 'openweathermap');
import Weather from "weather-greybutton";
class CustomService {
constructor(request) {
this.request = request;
}
static name = 'custom service';
getData() {
const response = this.request();
return response.data;
}
}
const options = {
http: 'http library, default axios',
service: [CustomService]
};
const weather = new Weather(options);
const berlinWeather = weather.getDataByCity('berlin', 'custom service');