From fb0a672a9bb317c8dccdbc5955f15974a1f11638 Mon Sep 17 00:00:00 2001 From: Justin Joshi Date: Sat, 4 Oct 2025 22:28:12 -0400 Subject: [PATCH 1/2] first commit --- README.md | 22 ++++++++++++++++++++-- css/style.css | 0 index.html | 15 +++++++++++++++ js/main.js | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 css/style.css create mode 100644 index.html create mode 100644 js/main.js diff --git a/README.md b/README.md index a9a4cc6..3408cb1 100644 --- a/README.md +++ b/README.md @@ -18,5 +18,23 @@ Example: ``` I completed the challenge: 5 I feel good about my code: 4 -I'm not sure if my constructors are setup cleanly... -``` + + +cat + +press button, get cat. + +yeah + +feeling super? get super cat! + +Tech used: HTML, CSS, JavaScript + +I used a simple fetch request to get cat. (cat) + +Optimizations + +shoulda put more cat tbh + +Lessons Learned: +i learned that i love putting cats into the dom. its very fun to watch them be silly \ No newline at end of file diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..e69de29 diff --git a/index.html b/index.html new file mode 100644 index 0000000..6c31f8d --- /dev/null +++ b/index.html @@ -0,0 +1,15 @@ + + + + + + Document + + + + + +
+ + + \ No newline at end of file diff --git a/js/main.js b/js/main.js new file mode 100644 index 0000000..36049e1 --- /dev/null +++ b/js/main.js @@ -0,0 +1,35 @@ +document.querySelector('#first').addEventListener('click', getData) +document.querySelector('#second').addEventListener('click', getData1) + +async function getData() { + const url = "https://api.thecatapi.com/v1/images/search"; + try { + const response = await fetch(url); + if (!response.ok) { + throw new Error(`Response status: ${response.status}`); + } + + const result = await response.json(); + document.querySelector('div').innerHTML += `` + } catch (error) { + console.error(error.message); + } +} + +async function getData1(e) { + const url = "https://api.thecatapi.com/v1/images/search?limit=10"; + try { + const response = await fetch(url); + if (!response.ok) { + throw new Error(`Response status: ${response.status}`); + } + + const result = await response.json(); + result.forEach((x, i) => { + document.querySelector('div').innerHTML += `` + console.log('hi') + }) + } catch (error) { + console.error(error.message); + } +} \ No newline at end of file From a4931102ef1b57c089eba26db293b38020982532 Mon Sep 17 00:00:00 2001 From: Justin Joshi Date: Tue, 7 Oct 2025 14:54:30 -0400 Subject: [PATCH 2/2] Update README.md --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3408cb1..d051696 100644 --- a/README.md +++ b/README.md @@ -15,26 +15,24 @@ - Anything specific on which you want feedback! Example: -``` + I completed the challenge: 5 I feel good about my code: 4 +https://justinjoshi.github.io/simple-api-bootcamp/ cat press button, get cat. -yeah - -feeling super? get super cat! Tech used: HTML, CSS, JavaScript -I used a simple fetch request to get cat. (cat) +I used a simple fetch request to get cat Optimizations shoulda put more cat tbh Lessons Learned: -i learned that i love putting cats into the dom. its very fun to watch them be silly \ No newline at end of file +i learned that i love putting cats into the dom. its very fun to watch them be silly