Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ app.get("/", async (request, response) => {
const posts = await prisma.post.findMany();
const html = template.replace(
"<!-- posts -->",
posts.map((post) => `<li>${escapeHTML(post.message)}</li>`).join(""),
posts.map((post) => `<li>${escapeHTML(post.message)}</li>`).join("")
);
response.send(html);
});
Expand Down
13 changes: 13 additions & 0 deletions static/mypage/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ユーザー登録</title>
<link rel="stylesheet" href="/mypage/style.css" />
</head>
<body>
<div id="app"></div>
<script src="/mypage/script.js"></script>
</body>
</html>
23 changes: 23 additions & 0 deletions static/mypage/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const app = document.getElementById("app");
const title = document.createElement("h1");
title.textContent = "ユーザー登録";
const form = document.createElement("form");
const table = document.createElement("table");
const info = ["苗字", "名前", "誕生日", "性別"];
for (tag of info) {
const tr = document.createElement("tr");
const td1 = document.createElement("td");
td1.textContent = tag;
const td2 = document.createElement("td");
const input = document.createElement("input");
td2.appendChild(input);
tr.appendChild(td1);
tr.appendChild(td2);
table.appendChild(tr);
}
const button = document.createElement("button");
button.textContent = "登録";
form.appendChild(table);
form.appendChild(button);
app.appendChild(title);
app.appendChild(form);
3 changes: 3 additions & 0 deletions static/mypage/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#app {
background-color: rgb(99, 184, 184);
}