-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample.js
35 lines (24 loc) · 790 Bytes
/
sample.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//import weather query package
var weatherQuery = require('dimtec-weather');
//Set you language
weatherQuery.setLanguage('es');
var OPEN_WEATHER_MAP_API_KEY = 'a66a80833494504a31c089ab4c91971e';
//Set you API KEY
weatherQuery.setApiKey(OPEN_WEATHER_MAP_API_KEY);
//Set you city
weatherQuery.setCityName('miami');
//Get a weather object with tons of details
weatherQuery.getWeather(function(data, error){
console.log(data);
})
//OR
//Set a geographical location
weatherQuery.setCoordinates({lat: 50.21, lon: -58.21});
//Get a weather object with tons of details
weatherQuery.getWeather(function(data, error){
console.log( data );
});
//Get the temperature number
weatherQuery.getTemperature(function(temperature, error){
console.log('Temperature ' + temperature);
});