This commit is contained in:
암냥 2026-08-13 01:03:34 +09:00
commit a59ac1f3cb
No known key found for this signature in database
14 changed files with 434 additions and 0 deletions

5
templates/edit.html Normal file
View file

@ -0,0 +1,5 @@
<form action="/edit/{{ post.id }}" method="POST">
<input placeholder="title" name="title" value="{{ post.title }}" />
<textarea placeholder="content" name="content">{{ post.content }}</textarea>
<button type="submit">Submit</button>
</form>

47
templates/index.html Normal file
View file

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>wow 게시판</title>
</head>
<body>
<h1>wow 게시판</h1>
<a href="/register">Register</a>
<a href="/login">Login</a>
<form action="/post" method="POST">
<input placeholder="title" name="title" />
<textarea placeholder="content" name="content"></textarea>
<button type="submit">Submit</button>
</form>
<form action="/" method="GET">
<input placeholder="search" name="q" />
<button type="submit">Search</button>
</form>
<div id="posts">
{% for post in posts %}
<a href="/post/{{ post.id }}">
<div class="post">
<h2>{{ post.title }}</h2>
<p>{{ post.content }}</p>
<a href="/edit/{{ post.id }}">Edit</a>
<a href="#" onclick="deletePost(`{{ post.id }}`)">Delete</a>
<hr />
</div>
</a>
{% endfor %}
</div>
<script>
function deletePost(postId) {
fetch(`/post/${postId}`, {
method: "DELETE",
})
.then(() => {
location.reload();
});
}
</script>
</body>
</html>

15
templates/login.html Normal file
View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login</title>
</head>
<body>
<form action="/login" method="POST">
<input type="text" name="username" placeholder="Username"><br>
<input type="password" name="password" placeholder="Password"><br>
<input type="submit" value="Login">
</form>
</body>
</html>

14
templates/post.html Normal file
View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ post_id }}</title>
</head>
<body>
<h1>{{ post.title }}</h1>
<p>{{ post_id }}</p>
<p>{{ post.content }}</p>
<a href="/">Back to home</a>
</body>
</html>

15
templates/register.html Normal file
View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Register</title>
</head>
<body>
<form action="/register" method="POST">
<input type="text" name="username" placeholder="Username"><br>
<input type="password" name="password" placeholder="Password"><br>
<input type="submit" value="Register">
</form>
</body>
</html>