From 36a6b96c3af3ee4218a79ef8509bd20cfb9cf3e8 Mon Sep 17 00:00:00 2001 From: ruben-aguilar Date: Sun, 22 Mar 2026 17:05:34 +0100 Subject: [PATCH] Fix broken API endpoint by migrating to dummyjson.com The previous jsonplaceholder.typicode.com/posts endpoint is no longer working. Replaced it with https://dummyjson.com/users and updated the data access to use the users array from the response. --- hello-world.mjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hello-world.mjs b/hello-world.mjs index 501c161..3956c32 100644 --- a/hello-world.mjs +++ b/hello-world.mjs @@ -1,20 +1,20 @@ import fetch from 'node-fetch'; // URL to fetch sample JSON data -const url = 'https://jsonplaceholder.typicode.com/posts'; +const url = 'https://dummyjson.com/users'; async function fetchData() { try { const response = await fetch(url); - + if (!response.ok) { throw new Error('Network response was not ok'); } const data = await response.json(); - // Accessing the title of the second post - var demoValue = data[1].title; // Adjust based on fetched data structure + // Accessing the name of the second user + var demoValue = data.users[1].firstName; console.log(`Demo Value: ${demoValue}`); console.log("Your environment is setup correctly!") } catch (error) {