Created
December 13, 2025 18:07
-
-
Save davidystephenson/561f092ce61d5f61df6ca86093466e2c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function getCategories () { | |
| const tbody = document.querySelector('tbody') | |
| const response = await fetch('http://localhost:3000/categories') | |
| const data = await response.json() | |
| console.log('data', data) | |
| /* | |
| description: "All Clothing for men" | |
| id: "19d4" | |
| isActive: true | |
| name: "Men's Clothing" | |
| */ | |
| for (const category of data) { | |
| tbody.innerHTML += ` | |
| <tr> | |
| <td>${category.id}</td> | |
| <td>${category.name}</td> | |
| <td>${category.description}</td> | |
| <td>${category.isActive}</td> | |
| <td></td> | |
| </tr> | |
| ` | |
| } | |
| } | |
| getCategories() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment