choi

Add the bulletin reading function

......@@ -86,6 +86,13 @@
</div>
<div class="col-lg-4">
<div class="features-icons-item mx-auto mb-5 mb-lg-0 mb-lg-3">
<div class="features-icons-icon d-flex"><i class="bi-window m-auto text-primary"></i></div>
<h3>Fully Responsive</h3>
<p class="lead mb-0">This theme will look great on any device, no matter the size!</p>
</div>
</div>
<div class="col-lg-4">
<div class="features-icons-item mx-auto mb-5 mb-lg-0 mb-lg-3">
<div class="features-icons-icon d-flex"><i class="bi-layers m-auto text-primary"></i></div>
<h3>Bootstrap 5 Ready</h3>
<p class="lead mb-0">Featuring the latest build of the new Bootstrap 5 framework!</p>
......
......@@ -15,14 +15,19 @@
sql 사용 파일<br>
router/login/index.js<br>
router/register/index.js<br><br>
router/register/index.js<br>
router/board/index.js<br><br>
DB 구조(*ID, password, type) -> 형식에 맞게 추가<br>
*ID varchar(20), password varchar(20), type varchar(10) // type이 운영자인 경우 서버에서 변경<br>
추가된 형식에 맞는 로그인 및 세션 등 변경<br>
DB구조 - board에서 사용됨(*idx, name, title, content, regdate, modidate, passwd, hit)<br>
*idx int, name varchar(50), title varchar(50), content mediumtext, regdate datetime, modidate datetime, passwd varchar(50), hit int<br>
LF 오류시 git config --global core.autocrlf true 입력<br><br>
최종 수정: 2021-11-16 18:54<br>
최종 수정 내용: 경로 지정 수정
\ No newline at end of file
최종 수정: 2021-11-17 06:01<br>
최종 수정 내용: 게시판의 글쓰기 및 글 열람 기능 추가.
\ No newline at end of file
......
......@@ -42,4 +42,14 @@ router.post('/write', function(req,res,next){
});
})
router.get('/read/:idx', function(req,res,next){
var idx = req.params.idx
var sql = "select idx, name, title, content, date_format(modidate,'%Y-%m-%d %H:%i:%s') modidate, " +
"date_format(regdate,'%Y-%m-%d %H:%i:%s') regdate,hit from board where idx=?";
board.query(sql,[idx], function(err,row){
if(err) console.error(err)
res.render('read.ejs', {title:"글 상세", row:row[0]})
})
})
module.exports = router;
\ No newline at end of file
......
<!DOCTYPE html>
<html>
<head>
<title><%= title %></title>
<link rel='stylesheet' href='/stylesheets/style.css'/>
</head>
<body>
<h1><%= title %></h1>
<form action="/board/update" method="post">
<table border="1">
<input type="hidden" name="idx" value="<%=row.idx%>"/>
<tr>
<td>작성자</td>
<td><input type="text" name="name" id="name" value="<%=row.name%>" required/></td>
</tr>
<tr>
<td>제목</td>
<td><input type="text" name="title" id="title" value="<%=row.title%>" required/></td>
</tr>
<tr>
<td>내용</td>
<td><textarea name="content" id="content" cols="30" rows="10" required><%=row.content%></textarea></td>
</tr>
<tr>
<td>패스워드</td>
<td><input type="password" name="passwd" id="passwd" required/></td>
</tr>
<tr>
<td>변경일</td>
<td><%=row.modidate%></td>
</tr>
<tr>
<td>등록일</td>
<td><%=row.regdate%></td>
</tr>
<tr>
<td>조회수</td>
<td><%=row.hit%></td>
</tr>
<tr>
<td colspan="2">
<button type="submit">글 수정</button>
<a href="/board/list">목록</a>
</td>
</tr>
</table>
</form>
</body>
</html>
\ No newline at end of file