강현태

mytoons 추가

This diff is collapsed. Click to expand it.
...@@ -9,6 +9,7 @@ var cheerio = require('cheerio'); ...@@ -9,6 +9,7 @@ var cheerio = require('cheerio');
9 var request = require('request'); 9 var request = require('request');
10 var index = require('./routes/index'); 10 var index = require('./routes/index');
11 var users = require('./routes/users'); 11 var users = require('./routes/users');
12 +var mytoons = require('./routes/mytoons');
12 13
13 var app = express(); 14 var app = express();
14 15
...@@ -26,7 +27,9 @@ app.use(express.static(path.join(__dirname, 'public'))); ...@@ -26,7 +27,9 @@ app.use(express.static(path.join(__dirname, 'public')));
26 27
27 app.use('/', index); 28 app.use('/', index);
28 app.use('/users', users); 29 app.use('/users', users);
29 -app.use(express.static('views')); 30 +app.use('/mytoons', mytoons);
31 +
32 +//app.use(express.static('views'));
30 33
31 // catch 404 and forward to error handler 34 // catch 404 and forward to error handler
32 app.use(function(req, res, next) { 35 app.use(function(req, res, next) {
......
...@@ -38,6 +38,7 @@ router.get('/', function(req, res, next) { ...@@ -38,6 +38,7 @@ router.get('/', function(req, res, next) {
38 title: '니툰내툰', 38 title: '니툰내툰',
39 list: allWebtoons 39 list: allWebtoons
40 }); 40 });
41 +
41 }); 42 });
42 43
43 44
......
1 +var express = require('express');
2 +var cheerio = require('cheerio');
3 +var request = require('request');
4 +var router = express.Router();
5 +
6 +/* GET home page. */
7 +router.get('/', function(req, res, next) {
8 + res.render('mytoons');
9 +});
10 +
11 +module.exports = router;
...\ No newline at end of file ...\ No newline at end of file
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
9 <p>웹툰 리스트</p> 9 <p>웹툰 리스트</p>
10 <a id="kakao-login-btn"></a> 10 <a id="kakao-login-btn"></a>
11 <a id="kakao-logout-btn" href="javascript:logout();">로그아웃</a> 11 <a id="kakao-logout-btn" href="javascript:logout();">로그아웃</a>
12 - <a id="save_config">저장</a>
13 12
14 13
15 <table> 14 <table>
...@@ -51,6 +50,7 @@ ...@@ -51,6 +50,7 @@
51 // 카카오 로그인 버튼을 생성합니다. 50 // 카카오 로그인 버튼을 생성합니다.
52 Kakao.Auth.getStatus(function(statusObj){ 51 Kakao.Auth.getStatus(function(statusObj){
53 if(statusObj.status=='connected'){ 52 if(statusObj.status=='connected'){
53 + location.href="./mytoons";
54 document.getElementById('kakao-login-btn').setAttribute('style','display: none;'); 54 document.getElementById('kakao-login-btn').setAttribute('style','display: none;');
55 }else{ 55 }else{
56 document.getElementById('kakao-logout-btn').setAttribute('style','display: none;'); 56 document.getElementById('kakao-logout-btn').setAttribute('style','display: none;');
...@@ -62,11 +62,11 @@ ...@@ -62,11 +62,11 @@
62 container: '#kakao-login-btn', 62 container: '#kakao-login-btn',
63 size:'small', 63 size:'small',
64 success: function(authObj) { 64 success: function(authObj) {
65 - alert(JSON.stringify(authObj)); 65 + //alert(JSON.stringify(authObj));
66 location.reload(); 66 location.reload();
67 }, 67 },
68 fail: function(err) { 68 fail: function(err) {
69 - alert(JSON.stringify(err)); 69 + alert("로그인 실패!");
70 } 70 }
71 }); 71 });
72 72
......
1 +<!DOCTYPE html>
2 +<html>
3 +<head>
4 + <title>내툰</title>
5 + <link rel='stylesheet' href='/stylesheets/style.css' />
6 + <script src="http://developers.kakao.com/sdk/js/kakao.min.js"></script>
7 +</head>
8 +<h1>내툰</h1>
9 +<p>추가한 리스트</p>
10 +<a id="kakao-login-btn"></a>
11 +<a id="kakao-logout-btn" href="javascript:logout();">로그아웃</a>
12 +<a id="save_config">저장</a>
13 +
14 +
15 +<table>
16 +</table>
17 +</br>
18 +
19 +<script type='text/javascript'>
20 + //<![CDATA[
21 + // 사용할 앱의 JavaScript 키를 설정해 주세요.
22 + Kakao.init('602377cd7aa60a82eeebda466560f3e5');
23 + // 카카오 로그인 버튼을 생성합니다.
24 + Kakao.Auth.getStatus(function(statusObj){
25 + if(statusObj.status=='connected'){
26 + document.getElementById('kakao-login-btn').setAttribute('style','display: none;');
27 + }else{
28 + alert("로그인 해주세요!");
29 + location.href="/";
30 + document.getElementById('kakao-logout-btn').setAttribute('style','display: none;');
31 + document.getElementById('save_config').setAttribute('style','display: none;');
32 + }
33 + });
34 +
35 + Kakao.Auth.createLoginButton({
36 + container: '#kakao-login-btn',
37 + size:'small',
38 + success: function(authObj) {
39 + location.reload();
40 + },
41 + fail: function(err) {
42 + alert("로그인 실패!");
43 + }
44 + });
45 +
46 + function logout(){
47 + Kakao.Auth.logout(function () {
48 + location.reload();
49 + });
50 +
51 + }
52 + //]]>
53 +
54 +</script>
55 +
56 +</body>
57 +
58 +</html>