Toggle navigation
Toggle navigation
This project
Loading...
Sign in
최시원
/
Singer-Composer
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
choi
2021-11-19 18:58:58 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f49e09620209c7ae4935e30ccfccaf56e018cbbe
f49e0962
1 parent
a7aa4b9b
View latest bulletin first
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
router/board/index.js
views/list.ejs
router/board/index.js
View file @
f49e096
...
...
@@ -8,15 +8,13 @@ var path = require('path') // 상대경로
var
mysql_odbc
=
require
(
'../../db/db_board'
)();
var
board
=
mysql_odbc
.
init
();
router
.
get
(
'/list/:page'
,
function
(
req
,
res
,
next
)
{
var
id
=
req
.
user
;
if
(
!
id
)
res
.
redirect
(
'/board/list/1'
)
else
{
var
page
=
req
.
params
.
page
;
var
sql
=
"select idx, name, title, date_format(modidate,'%Y-%m-%d %H:%i:%s') modidate, "
+
"date_format(regdate,'%Y-%m-%d %H:%i:%s') regdate, hit from board"
;
"date_format(regdate,'%Y-%m-%d %H:%i:%s') regdate, hit from board order by idx desc"
;
board
.
query
(
sql
,
function
(
err
,
rows
)
{
if
(
err
)
console
.
error
(
"err : "
+
err
);
var
id
=
req
.
user
.
ID
;
...
...
@@ -45,11 +43,13 @@ router.get('/write', function(req,res,next){
})
router
.
post
(
'/write'
,
function
(
req
,
res
,
next
){
var
name
=
req
.
body
.
name
var
id
=
req
.
user
.
ID
var
nickname
=
req
.
user
.
nickname
//var name = req.body.name
var
title
=
req
.
body
.
title
var
content
=
req
.
body
.
content
var
passwd
=
req
.
body
.
passwd
var
datas
=
[
name
,
title
,
content
,
passwd
]
//
var passwd = req.body.passwd
var
datas
=
[
ID
,
nickname
,
title
,
content
]
var
id
;
var
nickname
;
...
...
views/list.ejs
View file @
f49e096
...
...
@@ -44,7 +44,7 @@
<td>
등록일
</td>
</tr>
<
%
for(var i = (page * page_num)
- page_num; i
<
(page * page_num); i++) {
for(var i = (page * page_num)- page_num; i
<
(page * page_num); i++) {
if(i > length){
i++;
}else{
...
...
@@ -64,9 +64,10 @@
<tr>
<td
colspan=
"6"
>
<
%
for(var j = 0; j
< rows
.
length
/
page_num
;
j
++){
for(var j = 0; j
< rows
.
length
/
page_num
;
j
++){
%
>
[
<a
href=
"/board/list/<%= j + 1 %>"
>
<
%= j
+
1 %>
</a>
]
[
<a
href=
"/board/list/<%= j + 1 %>"
>
<
%= j
+
1 %>
</a>
]
<
%
}
%>
...
...
Please
register
or
login
to post a comment