-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
58 lines (50 loc) · 1.35 KB
/
app.js
File metadata and controls
58 lines (50 loc) · 1.35 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
var inquirer = require("inquirer");
var axios = require("axios");
var fs = require("fs");
var util = require("util");
var readFileAsync = util.promisify(fs.readFile);
var writeFileAsync = util.promisify(fs.writeFile);
var questions = function questions() {
return inquirer.prompt([
{
type: "input",
name: "name",
message: "What is your name?"
},
{
type: "input",
name: "github",
message: "Enter your GitHub Username"
},
{
type: "list",
message: "Pick a color",
choices: ["blue", "green", "red", "pink"],
name: "colors"
}
]);
};
questions().then(function(name) {
console.log(name.github, name.colors);
githubId = name.github;
axios
.get("https://api.github.com/users/".concat(githubId))
.then(function(res) {
answers = {
name: res.data.name,
color: name.colors,
location: res.data.location,
profilePic: res.data.avatar_url,
blog: res.data.blog,
followers: res.data.followers,
following: res.data.following,
repos: res.data.public_repos,
bio: res.data.bio
};
var generateHTML = require("./generateHTML");
var html = generateHTML(answers);
console.log(answers);
writeFileAsync("index.html", html);
console.log("Successfully wrote to index.html");
});
});