강상위

Feature Skeleton & Update

- 로그인 페이지 비정상 접근 리다이렉트
- Samename, Programs Skeleton
......@@ -16,12 +16,19 @@ module.exports = function(app, Users)
});
// 로그인 수행 - POST
app.post('/login', passport.authenticate('login',
app.route('/login')
.post(passport.authenticate('login',
{
successRedirect: '/main',
failureRedirect: '/'
//failureFlash : true
}));
}))
// unexpected access
.get(function(req, res)
{
res.redirect("/");
});
// 로그아웃 수행
app.get('/logout', function(req, res)
......@@ -85,6 +92,36 @@ module.exports = function(app, Users)
else res.redirect("/");
});
// 동명이인 검색 페이지
app.get("/samename" ,function(req, res)
{
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"]];
console.log("samename page");
res.render("samename",{samename : samename_list});
});
// 인물-방송정보 페이지
app.get("/programs", function(req, res)
{
var program_list =
[
["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",
"2018",
"아모르파티",
true,
"SUN",
"2240"],
["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",
"2018",
"아모르파티",
true,
"SUN",
"2240"]
];
res.render("programs", {programs: program_list});
});
}
......
<div class="contents_main">
<h1>This is main</h1>
<form method="GET" action="/samename">
<input type="text" name="samename">
<button type="submit">검색</button>
</form>
</div>
\ No newline at end of file
......
<div class="contents_main">
<h1>This is Programs</h1>
<% programs.forEach(function(val){ %>
<li><img src="<%= val[0]%>"></li>
<li><%= val[1]%></li>
<li><%= val[2]%></li>
<% if(val[3] == true) { %>
<li><%= val[4] %></li>
<li><%= val[5] %></li>
<% } %>
<% }) %>
</div>
\ No newline at end of file
<div class="contents_main">
<h1>This is Samename</h1>
<% samename.forEach(function(val){ %>
<li><%= val[0]%></li>
<li><img src="<%= val[1]%>"></li>
<% }) %>
</div>
\ No newline at end of file
<div class="navigation_main">
<a href="/logout"><button>로그아웃</button></a>
<button>검색</button>
<a href="/main"><button>검색</button></a>
<a href="/mypage"><button>마이페이지</button></a>
<button>나만의시간표</button>
</div>
\ No newline at end of file
......
<html>
<head>
<title>Programs</title>
</head>
<body>
<% include ./navigation_main.ejs %>
<% include ./contents_programs.ejs %>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>Samename</title>
</head>
<body>
<% include ./navigation_main.ejs %>
<% include ./contents_samename.ejs %>
</body>
</html>
\ No newline at end of file