47 lines
1.2 KiB
HTML
47 lines
1.2 KiB
HTML
|
|
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<script crossorigin="anonymous" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.19.2/moment.js"></script>
|
|
<title>Journal d'un formateur en bootcamp</title>
|
|
|
|
<main id=journaux>
|
|
</main>
|
|
|
|
|
|
<script>
|
|
'use strict';
|
|
|
|
const afficheLaListeDesJournaux = () => {
|
|
const container = document.querySelector('#journaux');
|
|
|
|
fetch('https://api.daktary.com/yaf/journal-d-un-formateur-en-2015/tree/master/journaux')
|
|
.then(response => response.json())
|
|
.then(journaux => {
|
|
journaux.body.forEach(journal => {
|
|
const entreeDeJournal = MiseEnFormeDe(journal);
|
|
container.append(entreeDeJournal);
|
|
});
|
|
});
|
|
};
|
|
|
|
const MiseEnFormeDe = (journal) => {
|
|
const sectionJournal = document.createElement('section');
|
|
sectionJournal.innerHTML = journal.body;
|
|
|
|
const titreJournal = document.createElement('h1');
|
|
titreJournal.textContent = journal.meta.titre;
|
|
sectionJournal.prepend(titreJournal);
|
|
|
|
return sectionJournal;
|
|
}
|
|
|
|
afficheLaListeDesJournaux();
|
|
</script>
|
|
|
|
|
|
</html>
|