remove frontend for rewrite

This commit is contained in:
agatha 2024-04-09 17:19:46 -04:00
parent c3a88e187f
commit e481968ab2
4 changed files with 0 additions and 52 deletions

View File

@ -1,33 +0,0 @@
const apiUrl = 'http://localhost:8001';
function createTable(selector, items) {
const $table = $("<table></table>");
const $headerRow = $("<tr></tr>");
$.each(Object.keys(items[0]), function(i, key) {
const $th = $("<th></th>").text(key)
$headerRow.append($th);
});
$table.append($headerRow);
$.each(items, function (i, item) {
const $tr = $("<tr></tr>");
$.each(item, function(key, value) {
const $td = $("<td></td>").text(value);
$tr.append($td);
});
$table.append($tr);
});
console.log($table);
$(selector).append($table);
}
function getCatalog() {
$.getJSON(apiUrl + "/catalog", function (resp) {
createTable('.posts', resp);
});
}
$( document ).ready(function() {
getCatalog();
});

File diff suppressed because one or more lines are too long

View File

@ -1,17 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Single-board Forum</title>
<link rel="stylesheet" href="assets/css/main.css">
<meta charset="UTF-8">
<script src="assets/js/jquery-3.7.1.min.js"></script>
<script src="assets/js/app.js" defer></script>
</head>
<body>
<header>
<h1>Single-board Forum</h1>
</header>
<div class="posts">
</div>
</body>
</html>