-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
37 lines (29 loc) · 953 Bytes
/
app.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
36
37
const geoCode = require("./utils/geoutils");
const weatherCode = require("./utils/weatherutils");
var prompt = require('prompt');
const chalk = require('chalk');
console.log("\n\t\t "+chalk.blue("Welcome To the")+chalk.red(" Dark Sky")+chalk.blue(" Weather Predection App"+chalk.green(" !!\n")))
prompt.start();
let address = null;
prompt.get([{
name: 'Address',
required: true
// pattern: /^[a-zA-Z0-9\s\-]+$/
}], function (err, result) {
address = result.Address;
geoCode(address,(error,data) => {
if(error){
console.log("Error 1 - "+ error);
} else {
let response = data;
weatherCode(response.latitude,response.longitude,(error,data) => {
if(error){
console.log("Error 2 - "+ error);
} else {
console.log(data);
}
});
}
})
});
// console.log("\n"+address);