diff --git a/public/css/board.css b/public/css/board.css index 36b8e1e..69c8d24 100644 --- a/public/css/board.css +++ b/public/css/board.css @@ -7,6 +7,7 @@ body { padding: 0; margin: 0; background-color:#242424; + overflow: auto; } a { text-decoration: none; diff --git a/public/css/board_view_css.css b/public/css/board_view_css.css index 50a9924..604f1a7 100644 --- a/public/css/board_view_css.css +++ b/public/css/board_view_css.css @@ -50,8 +50,7 @@ a { padding: 0 5px; } .content{ - width: 100%; - height: 50vh; + width: 100%; text-align: left; padding-left: 10px; padding-right: 10px; diff --git a/routes/likeRouter.js b/routes/likeRouter.js index 6b336a9..219d7db 100644 --- a/routes/likeRouter.js +++ b/routes/likeRouter.js @@ -6,6 +6,18 @@ const template = require('../template/likes_list'); // prefix: /likes +function dateFormat(date) { + var newdate = new Date(date); + let month = newdate.getMonth() + 1; + let day = newdate.getDate(); + + month = month >= 10 ? month : '0' + month; + day = day >= 10 ? day : '0' + day; + + return newdate.getFullYear() + '.' + month + '.' + day + ' '; +}; + + router.get('/', function(request, response) { console.log(request.user); if(!request.isAuthenticated()){ @@ -16,9 +28,15 @@ router.get('/', function(request, response) { FROM post, liked WHERE post.id = liked.postId and liked.userId=${request.user.id} group by post.id`, function(err, result) { - console.log(result); + + if(result.length == 0){ + response.send(''); + }else{ + var list =''; - console.log(result[0].createdate) + var date = dateFormat(result[0].createdate); + for (var i = 0;i < result.length; i++) { list += ` @@ -26,11 +44,11 @@ router.get('/', function(request, response) {

${result[i].title}

-
${request.user.nickname} | ${result[i].createdate}
+
${request.user.nickname} | ${date}
- +
${result[i].count}
@@ -40,6 +58,8 @@ router.get('/', function(request, response) { var body = template.HOME(list, request.user); var html = template.HTML(body); response.send(html); + } + }) } }); diff --git a/routes/myboardRouter.js b/routes/myboardRouter.js index 573868a..141df85 100644 --- a/routes/myboardRouter.js +++ b/routes/myboardRouter.js @@ -5,6 +5,18 @@ const boardlist = require('../template/likes_list.js'); // /myboard +function dateFormat(date) { + var newdate = new Date(date); + let month = newdate.getMonth() + 1; + let day = newdate.getDate(); + + month = month >= 10 ? month : '0' + month; + day = day >= 10 ? day : '0' + day; + + return newdate.getFullYear() + '.' + month + '.' + day + ' '; +}; + + router.get('/', function(request, response) { if(!request.isAuthenticated()){ response.send(''); + }else{ + if (err) throw err; + + var list =''; + + var date = dateFormat(result[0].createdate); + + for (var i = 0;i < result.length; i++) { + list += ` +
+ +
+

${result[i].title}

+
${request.user.nickname} | ${date}
+
+
+
+ +
${result[i].count}
+
+
+ ` + } + const body = boardlist.HOME(list, request.user); + response.send(boardlist.HTML(body)); } - const body = boardlist.HOME(list, request.user); - response.send(boardlist.HTML(body)); + + + }) } }); diff --git a/template/board.js b/template/board.js index a2928f4..220672d 100644 --- a/template/board.js +++ b/template/board.js @@ -136,7 +136,7 @@ module.exports = { -
+