diff --git a/public/index.html b/public/index.html index f89dd7a..e06a726 100644 --- a/public/index.html +++ b/public/index.html @@ -3,11 +3,25 @@ - My Store + Aaron Williamson - + +
+

Products

+
+
+ +
diff --git a/public/index.js b/public/index.js index 6515a73..faf5751 100644 --- a/public/index.js +++ b/public/index.js @@ -1,2 +1,23 @@ -//stuff -//more stuff \ No newline at end of file +const url = 'https://my-json-server.typicode.com/jubs16/Products/Products' + + +function getPosts() { + fetch(url) + .then(response => response.json()) + .then((posts) => { + return posts.forEach(function(x) { + const ul = document.getElementById('fetch') + + let img = document.createElement('img') + img.src = `${x.imgUrl}` + + let li = document.createElement('li') + li.innerHTML = `${x.name} $${x.price}` + + ul.appendChild(li) + ul.appendChild(img) + }) + + }) +} +getPosts() \ No newline at end of file