60 lines
2.5 KiB
HTML
60 lines
2.5 KiB
HTML
<html lang="ru">
|
|
|
|
</html>
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Моя страница</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<script type="module" src="./node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
|
|
<link href="./node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />
|
|
<link href="./node_modules/bootstrap-icons/font/bootstrap-icons.min.css" rel="stylesheet" />
|
|
<link rel="stylesheet" href="./css/style.css">
|
|
</head>
|
|
|
|
<body class="h-100 d-flex flex-column">
|
|
<header>
|
|
<nav class="navbar navbar-expand-md navbar-dark">
|
|
<div class="container-fluid">
|
|
<a class="navbar-brand" href="/">
|
|
<i class="bi bi-app"></i>
|
|
Мой сайт
|
|
</a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
|
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="navbar-collapse collapse justify-content-end" id="navbarNav">
|
|
<div class="navbar-nav">
|
|
<a class="nav-link" href="./index.html">Главная страница</a>
|
|
<a class="nav-link" href="./page2.html">Вторая страница</a>
|
|
<a class="nav-link" href="./page3.html">Третья страница</a>
|
|
<a class="nav-link active" href="./page-js.html">JavaScript</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
<main id="students" class="container-fluid p-3">
|
|
</main>
|
|
<footer class="footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center">
|
|
Автор, 2022
|
|
</footer>
|
|
<script type="module">
|
|
const getPosts = async () => {
|
|
const students = document.getElementById("students");
|
|
const response = await fetch("http://localhost:3001/students?_embed=group");
|
|
const data = await response.json();
|
|
data.forEach(element => {
|
|
students.innerHTML += `<p>${element.last_name} - ${element.group.name}</p>`;
|
|
});
|
|
console.log(data);
|
|
};
|
|
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
getPosts();
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |