-
Notifications
You must be signed in to change notification settings - Fork 9
/
test.html
87 lines (79 loc) · 2.28 KB
/
test.html
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
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Proxy Test</title>
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
$.ajax({
url: 'http://localhost:4500',
// url: 'http://proxy.hackeryou.com',
type: 'GET',
dataType: 'json',
data: {
reqUrl: 'http://api.brewerydb.com/v2/beers',
params: {
"key" :"217d6bd3a9e78edebe4af03ca28fa01b",
"styleId" :1
},
useCache: false,
proxyHeaders: {
'X-Something-Cool':'whoooooa'
}
}
}).then(function(res) {
console.log(res);
},console.log);
//https://sheetsu.com/apis/14561de4
// var books = $.ajax({
// url: 'https://sheetsu.com/apis/14561de4',
// dataType: 'json',
// method: 'GET'
// });
// myAPIProject = {};
// myAPIProject.goodreadsAPI = {}; // empty object to store all the goodreads API info
// myAPIProject.goodreadsAPI.endpoint = 'https://www.goodreads.com/book/title.xml';
// myAPIProject.goodreadsAPI.key = 'AYoaCzPGXisCTWsP6Ainw'
// myAPIProject.goodreadsAPI.getBooks = function(selectedBook) {
// return $.ajax({
// url: 'http://localhost:4500', // send the initial request through the HY proxy app because the endpoint returns XML. We need to mask the URL through another.
// dataType: 'json',
// method: 'GET',
// data: { // This is where we pass in info regarding the endpoint we want to use.
// reqUrl: myAPIProject.goodreadsAPI.endpoint, // Put API endpoint here
// params: { // act as a query string ie. data property in jquery
// key: myAPIProject.goodreadsAPI.key,
// title: selectedBook.bookTitle
// },
// xmlToJSON: true
// }
// })
// };
// books.then(function(bookData) {
// console.log(bookData);
// var myBooks = bookData.result.map((book) => {
// return myAPIProject.goodreadsAPI.getBooks(book);
// });
// $.when.apply(null,myBooks).done(() => {
// console.log(arguments);
// })
// });
// myAPIProject.getBooks();
const pokeIds = [2,3,4,5,6,7,8];
const pokeCalls = pokeIds.map((poke) => (
$.ajax({
url: 'http://localhost:4500',
dataType: 'json',
method: 'GET',
data: {
reqUrl: `http://pokeapi.co/api/v2/pokemon/${poke}`,
useCache:true
}
})
))
const zomatoKey = "056fe9f78b1e5583b4b472414c36ebde";
</script>
</body>
</html>