quiero mostrar los datos dentro de esta url en mi nodo, pero no muestra ninguno, hay algo que hago mal en mi código
const extractRefDefaultSchema = async (data) => { const url = "https://mos.esante.gouv.fr/NOS/TRE_R81-Civilite/FHIR/TRE-R81-Civilite/TRE_R81-Civilite-FHIR.json" https.get(url,(res) => { let body = ""; res.on("data", (chunk) => { body += chunk; }); res.on("end", () => { try { let json = JSON.parse(body); // do something with JSON } catch (error) { console.error(error.message); }; }); }).on("error", (error) => { console.error(error.message); }); console.log("extractRefDefaultSchema");};
Puede usar la API de búsqueda para hacer esto:
fetch(url) .then((res)=> res.json()) .then((json) => { let dataJson = JSON.parse(json) })