Test MapX mirror

by fxi

JavaScript

const url = "https://jsonplaceholder.typicode.com/comments"
const urlMirror = "https://api.mapx.org/get/mirror?url="+url;
const elContainer=document.createElement("div");
document.body.appendChild(elContainer);

fetch(urlMirror)
  .then(response => response.json())
  .then(list)



function list(data){
  const el = document.createElement('ul');
  elContainer.innerHTML='';
  for(let i=0,iL = data.length;i<iL;i++){
     el.appendChild(item(data[i]));
  }
  elContainer.appendChild(el);
}

function item(it){
  const el = document.createElement('li')
  el.innerText = it.body;
  return el;
}