강상위

Feature Skeleton & Update

- 로그인 페이지 비정상 접근 리다이렉트
- Samename, Programs Skeleton
...@@ -16,12 +16,19 @@ module.exports = function(app, Users) ...@@ -16,12 +16,19 @@ module.exports = function(app, Users)
16 }); 16 });
17 17
18 // 로그인 수행 - POST 18 // 로그인 수행 - POST
19 - app.post('/login', passport.authenticate('login', 19 + app.route('/login')
20 + .post(passport.authenticate('login',
20 { 21 {
21 successRedirect: '/main', 22 successRedirect: '/main',
22 failureRedirect: '/' 23 failureRedirect: '/'
23 //failureFlash : true 24 //failureFlash : true
24 - })); 25 + }))
26 + // unexpected access
27 + .get(function(req, res)
28 + {
29 + res.redirect("/");
30 + });
31 +
25 32
26 // 로그아웃 수행 33 // 로그아웃 수행
27 app.get('/logout', function(req, res) 34 app.get('/logout', function(req, res)
...@@ -85,6 +92,36 @@ module.exports = function(app, Users) ...@@ -85,6 +92,36 @@ module.exports = function(app, Users)
85 else res.redirect("/"); 92 else res.redirect("/");
86 }); 93 });
87 94
95 +
96 + // 동명이인 검색 페이지
97 + app.get("/samename" ,function(req, res)
98 + {
99 + var samename_list = [["강호동", "https://search.pstatic.net/common?type=a&size=60x76&quality=95&src=http://sstatic.naver.net/people/portrait/201304/20130403113314207.jpg"], ["강호동", "https://search.pstatic.net/common?type=a&size=60x76&quality=95&src=http://sstatic.naver.net/people/72/201601061648058211.jpg"]];
100 + console.log("samename page");
101 + res.render("samename",{samename : samename_list});
102 + });
103 +
104 + // 인물-방송정보 페이지
105 + app.get("/programs", function(req, res)
106 + {
107 + var program_list =
108 + [
109 + ["https://search.pstatic.net/common?type=o&size=120x172&quality=90&direct=true&src=http%3A%2F%2Fsstatic.naver.net%2Fkeypage%2Fimage%2Fdss%2F57%2F03%2F30%2F31%2F57_9033031_poster_image_1543806768348.jpg",
110 + "2018",
111 + "아모르파티",
112 + true,
113 + "SUN",
114 + "2240"],
115 + ["https://search.pstatic.net/common?type=o&size=120x172&quality=90&direct=true&src=http%3A%2F%2Fsstatic.naver.net%2Fkeypage%2Fimage%2Fdss%2F57%2F03%2F30%2F31%2F57_9033031_poster_image_1543806768348.jpg",
116 + "2018",
117 + "아모르파티",
118 + true,
119 + "SUN",
120 + "2240"]
121 + ];
122 + res.render("programs", {programs: program_list});
123 + });
124 +
88 125
89 } 126 }
90 127
......
1 <div class="contents_main"> 1 <div class="contents_main">
2 <h1>This is main</h1> 2 <h1>This is main</h1>
3 + <form method="GET" action="/samename">
4 + <input type="text" name="samename">
5 + <button type="submit">검색</button>
6 + </form>
3 </div> 7 </div>
...\ No newline at end of file ...\ No newline at end of file
......
1 +<div class="contents_main">
2 + <h1>This is Programs</h1>
3 + <% programs.forEach(function(val){ %>
4 + <li><img src="<%= val[0]%>"></li>
5 + <li><%= val[1]%></li>
6 + <li><%= val[2]%></li>
7 +
8 + <% if(val[3] == true) { %>
9 + <li><%= val[4] %></li>
10 + <li><%= val[5] %></li>
11 + <% } %>
12 + <% }) %>
13 +</div>
...\ No newline at end of file ...\ No newline at end of file
1 +<div class="contents_main">
2 + <h1>This is Samename</h1>
3 + <% samename.forEach(function(val){ %>
4 + <li><%= val[0]%></li>
5 + <li><img src="<%= val[1]%>"></li>
6 + <% }) %>
7 +</div>
...\ No newline at end of file ...\ No newline at end of file
1 <div class="navigation_main"> 1 <div class="navigation_main">
2 <a href="/logout"><button>로그아웃</button></a> 2 <a href="/logout"><button>로그아웃</button></a>
3 - <button>검색</button> 3 + <a href="/main"><button>검색</button></a>
4 <a href="/mypage"><button>마이페이지</button></a> 4 <a href="/mypage"><button>마이페이지</button></a>
5 <button>나만의시간표</button> 5 <button>나만의시간표</button>
6 </div> 6 </div>
...\ No newline at end of file ...\ No newline at end of file
......
1 +<html>
2 +<head>
3 + <title>Programs</title>
4 +</head>
5 +<body>
6 + <% include ./navigation_main.ejs %>
7 + <% include ./contents_programs.ejs %>
8 +</body>
9 +</html>
...\ No newline at end of file ...\ No newline at end of file
1 +<html>
2 +<head>
3 + <title>Samename</title>
4 +</head>
5 +<body>
6 + <% include ./navigation_main.ejs %>
7 + <% include ./contents_samename.ejs %>
8 +</body>
9 +</html>
...\ No newline at end of file ...\ No newline at end of file