init
This commit is contained in:
commit
a59ac1f3cb
14 changed files with 434 additions and 0 deletions
47
templates/index.html
Normal file
47
templates/index.html
Normal 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>
|
||||
Loading…
Reference in a new issue