choi

Add the bulletin reading function

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