-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
77 lines (74 loc) · 3.32 KB
/
index.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
const {ApolloServer,gql} = require('apollo-server');
//Data
const countries = [
{
"id": 1,
"country": "Argentina",
"population": 444,
"growth":519,
"wikipedia": "https://en.wikipedia.org/wiki/Argentina",
"image": "https://www.verdict.co.uk/wp-content/uploads/2017/04/argentina2-1.jpg",
"description": " Contrary to popular belief, Argentina is actually considered a developing country. Argentina’s economy was strong enough to ensure its citizens a good quality of life during the first part of the 20th century.The makes Argentina one of the strongest countries in South America."
},
{
"id": 2,
"country": "Guyana",
"population": 1,
"growth": 3,
"wikipedia":"https://en.wikipedia.org/wiki/Guyana",
"image": "https://i.pinimg.com/originals/36/39/8e/36398e7cc98b5b4263a959576d880b8c.jpg",
"description": "Experts have said that Guyana has one of the fastest-growing economies in the world. It had a GDP of $3.63 billion and a growth rate of 4.1 percent in 2018. If all goes according to plan, Guyana’s economy has the potential to grow up to 33.5 percent and 22.9 percent in 2020 and 2021."
},
{
"id": 3,
"country": "India",
"population": 1380004385,
"growth": 27,
"wikipedia":"https://en.wikipedia.org/wiki/India",
"image": "https://i1.wp.com/www.theworldin257clicks.com/img/indi.jpg?resize=350%2C232",
"description": "As the second most populated country in the world, India has run into many problems involving poverty, overcrowding and a lack of access to appropriate medical care. Despite this, India has a large well-skilled workforce that has contributed to its fast-growing and largely diverse economy."
},
{
"id": 4,
"country": "Brazil",
"population": 2091,
"growth": 1869,
"wikipedia":"https://en.wikipedia.org/wiki/Brazil",
"image": "https://cdnuploads.aa.com.tr/uploads/Contents/2019/06/17/thumbs_b_c_e8c3f43bbfaacbbd2735b686d95466b5.jpg?v=100829",
"description": "Brazil is currently working its way out of one of the worst economic recessions in its history. As a result, its GDP growth has increased by 1 percent and its inflation rate has decreased to 2.9 percent."
},
{
"id": 5,
"country": "china",
"population": 1393,
"growth": 1361,
"wikipedia":"https://en.wikipedia.org/wiki/China",
"image": "https://specials-images.forbesimg.com/imageserve/5df7fb014e2917000783339f/960x0.jpg?fit=scale",
"description": "Since China began reforming its economy in 1978, its GDP has had an average growth of almost 10 percent a year. Despite the fact that it is the world’s second-largest economy, China’s per capita income is relatively low compared to other high-income countries. "
}
]
///resolver
const resolvers = {
Query: {
countries: () => countries
}
}
const typeDefs=gql`
type Countries{
id: Int
country: String
population: Int
growth:Int
description:String
image: String
wikipedia: String
}
type Query{
countries: [Countries]
}
`
///initailize/
const server = new ApolloServer({typeDefs , resolvers})
server.listen().then(({url}) => {
console.log(`🚀 Server ready at ${url}`)
})