강현태

DB 동기화 완료

......@@ -35,49 +35,56 @@
<DataType>text|0</DataType>
<NotNull>1</NotNull>
</column>
<key id="12" parent="4" name="PRIMARY">
<column id="12" parent="4" name="latest">
<Position>6</Position>
<DataType>int(11)|0</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&apos;0&apos;</DefaultExpression>
</column>
<key id="13" parent="4" name="PRIMARY">
<NameSurrogate>1</NameSurrogate>
<ColNames>toon_index</ColNames>
<Primary>1</Primary>
</key>
<column id="13" parent="5" name="id">
<column id="14" parent="5" name="id">
<Position>1</Position>
<DataType>bigint(20)|0</DataType>
<NotNull>1</NotNull>
</column>
<key id="14" parent="5" name="PRIMARY">
<key id="15" parent="5" name="PRIMARY">
<NameSurrogate>1</NameSurrogate>
<ColNames>id</ColNames>
<Primary>1</Primary>
</key>
<column id="15" parent="6" name="user_id">
<column id="16" parent="6" name="user_id">
<Position>1</Position>
<DataType>bigint(20)|0</DataType>
<NotNull>1</NotNull>
</column>
<column id="16" parent="6" name="toon_index">
<column id="17" parent="6" name="toon_index">
<Position>2</Position>
<DataType>int(11)|0</DataType>
<NotNull>1</NotNull>
</column>
<column id="17" parent="6" name="recent">
<column id="18" parent="6" name="last">
<Position>3</Position>
<DataType>text|0</DataType>
<DataType>int(11)|0</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&apos;0&apos;</DefaultExpression>
</column>
<index id="18" parent="6" name="toon_index">
<index id="19" parent="6" name="toon_index">
<ColNames>toon_index</ColNames>
</index>
<index id="19" parent="6" name="user_id">
<index id="20" parent="6" name="user_id">
<ColNames>user_id</ColNames>
</index>
<foreign-key id="20" parent="6" name="user_toon_relation_ibfk_1">
<foreign-key id="21" parent="6" name="user_toon_relation_ibfk_1">
<ColNames>user_id</ColNames>
<RefSchemaName>YTMT</RefSchemaName>
<RefTableName>user</RefTableName>
<RefColNames>id</RefColNames>
</foreign-key>
<foreign-key id="21" parent="6" name="user_toon_relation_ibfk_2">
<foreign-key id="22" parent="6" name="user_toon_relation_ibfk_2">
<ColNames>toon_index</ColNames>
<RefSchemaName>YTMT</RefSchemaName>
<RefTableName>toon</RefTableName>
......
This diff is collapsed. Click to expand it.
......@@ -16,12 +16,12 @@ var setting = require('./routes/setting');
var session = require('express-session');
passport.serializeUser(function(user, done) {
console.log('serialize');
console.log('serialized');
done(null, user);
});
passport.deserializeUser(function(obj, done) {
console.log('deserialize');
done(null, obj);
passport.deserializeUser(function(user, done) {
console.log('deserialized');
done(null, user);
});
var app = express();
......
......@@ -2,18 +2,18 @@
"_args": [
[
{
"raw": "async@^2.0.1",
"raw": "async",
"scope": null,
"escapedName": "async",
"name": "async",
"rawSpec": "^2.0.1",
"spec": ">=2.0.1 <3.0.0",
"type": "range"
"rawSpec": "",
"spec": "latest",
"type": "tag"
},
"/Users/kanghyeontae/IdeaProjects/YTMT/node_modules/form-data"
"/Users/kanghyeontae/IdeaProjects/YTMT"
]
],
"_from": "async@>=2.0.1 <3.0.0",
"_from": "async@latest",
"_id": "async@2.6.0",
"_inCache": true,
"_location": "/async",
......@@ -29,22 +29,24 @@
"_npmVersion": "5.5.1",
"_phantomChildren": {},
"_requested": {
"raw": "async@^2.0.1",
"raw": "async",
"scope": null,
"escapedName": "async",
"name": "async",
"rawSpec": "^2.0.1",
"spec": ">=2.0.1 <3.0.0",
"type": "range"
"rawSpec": "",
"spec": "latest",
"type": "tag"
},
"_requiredBy": [
"/form-data"
"#USER",
"/",
"/phantomjs/form-data"
],
"_resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz",
"_shasum": "61a29abb6fcc026fea77e56d1c6ec53a795951f4",
"_shrinkwrap": null,
"_spec": "async@^2.0.1",
"_where": "/Users/kanghyeontae/IdeaProjects/YTMT/node_modules/form-data",
"_spec": "async",
"_where": "/Users/kanghyeontae/IdeaProjects/YTMT",
"author": {
"name": "Caolan McMahon"
},
......
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli 'cookieSession',
1 verbose cli '--save' ]
2 info using npm@3.10.10
3 info using node@v6.11.4
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData cookieSession
8 silly fetchNamedPackageData cookieSession
9 silly mapToRegistry name cookieSession
10 silly mapToRegistry using default registry
11 silly mapToRegistry registry https://registry.npmjs.org/
12 silly mapToRegistry data Result {
12 silly mapToRegistry raw: 'cookieSession',
12 silly mapToRegistry scope: null,
12 silly mapToRegistry escapedName: 'cookieSession',
12 silly mapToRegistry name: 'cookieSession',
12 silly mapToRegistry rawSpec: '',
12 silly mapToRegistry spec: 'latest',
12 silly mapToRegistry type: 'tag' }
13 silly mapToRegistry uri https://registry.npmjs.org/cookieSession
14 verbose request uri https://registry.npmjs.org/cookieSession
15 verbose request no auth needed
16 info attempt registry request try #1 at 10:46:34 PM
17 verbose request id 6a301e79ad3ee39e
18 http request GET https://registry.npmjs.org/cookieSession
19 http 404 https://registry.npmjs.org/cookieSession
20 verbose headers { 'content-type': 'application/json',
20 verbose headers 'cache-control': 'max-age=0',
20 verbose headers 'content-length': '2',
20 verbose headers 'accept-ranges': 'bytes',
20 verbose headers date: 'Tue, 05 Dec 2017 13:46:36 GMT',
20 verbose headers via: '1.1 varnish',
20 verbose headers connection: 'keep-alive',
20 verbose headers 'x-served-by': 'cache-nrt6151-NRT',
20 verbose headers 'x-cache': 'MISS',
20 verbose headers 'x-cache-hits': '0',
20 verbose headers 'x-timer': 'S1512481595.892739,VS0,VE1380',
20 verbose headers vary: 'Accept-Encoding' }
21 silly get cb [ 404,
21 silly get { 'content-type': 'application/json',
21 silly get 'cache-control': 'max-age=0',
21 silly get 'content-length': '2',
21 silly get 'accept-ranges': 'bytes',
21 silly get date: 'Tue, 05 Dec 2017 13:46:36 GMT',
21 silly get via: '1.1 varnish',
21 silly get connection: 'keep-alive',
21 silly get 'x-served-by': 'cache-nrt6151-NRT',
21 silly get 'x-cache': 'MISS',
21 silly get 'x-cache-hits': '0',
21 silly get 'x-timer': 'S1512481595.892739,VS0,VE1380',
21 silly get vary: 'Accept-Encoding' } ]
22 silly fetchPackageMetaData Error: Registry returned 404 for GET on https://registry.npmjs.org/cookieSession
22 silly fetchPackageMetaData at makeError (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:302:12)
22 silly fetchPackageMetaData at CachingRegistryClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:280:14)
22 silly fetchPackageMetaData at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:210:14)
22 silly fetchPackageMetaData at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:187:22)
22 silly fetchPackageMetaData at emitTwo (events.js:106:13)
22 silly fetchPackageMetaData at Request.emit (events.js:191:7)
22 silly fetchPackageMetaData at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1048:10)
22 silly fetchPackageMetaData at emitOne (events.js:96:13)
22 silly fetchPackageMetaData at Request.emit (events.js:188:7)
22 silly fetchPackageMetaData at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:969:12)
22 silly fetchPackageMetaData error for cookieSession { Error: Registry returned 404 for GET on https://registry.npmjs.org/cookieSession
22 silly fetchPackageMetaData at makeError (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:302:12)
22 silly fetchPackageMetaData at CachingRegistryClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:280:14)
22 silly fetchPackageMetaData at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:210:14)
22 silly fetchPackageMetaData at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:187:22)
22 silly fetchPackageMetaData at emitTwo (events.js:106:13)
22 silly fetchPackageMetaData at Request.emit (events.js:191:7)
22 silly fetchPackageMetaData at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1048:10)
22 silly fetchPackageMetaData at emitOne (events.js:96:13)
22 silly fetchPackageMetaData at Request.emit (events.js:188:7)
22 silly fetchPackageMetaData at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:969:12) pkgid: 'cookieSession', statusCode: 404, code: 'E404' }
23 silly rollbackFailedOptional Starting
24 silly rollbackFailedOptional Finishing
25 silly runTopLevelLifecycles Finishing
26 silly install printInstalled
27 verbose stack Error: Registry returned 404 for GET on https://registry.npmjs.org/cookieSession
27 verbose stack at makeError (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:302:12)
27 verbose stack at CachingRegistryClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:280:14)
27 verbose stack at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:210:14)
27 verbose stack at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:187:22)
27 verbose stack at emitTwo (events.js:106:13)
27 verbose stack at Request.emit (events.js:191:7)
27 verbose stack at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1048:10)
27 verbose stack at emitOne (events.js:96:13)
27 verbose stack at Request.emit (events.js:188:7)
27 verbose stack at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:969:12)
28 verbose statusCode 404
29 verbose pkgid cookieSession
30 verbose cwd /Users/kanghyeontae/IdeaProjects/YTMT
31 error Darwin 17.2.0
32 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "cookieSession" "--save"
33 error node v6.11.4
34 error npm v3.10.10
35 error code E404
36 error 404 Registry returned 404 for GET on https://registry.npmjs.org/cookieSession
37 error 404
38 error 404 'cookieSession' is not in the npm registry.
39 error 404 Your package name is not valid, because
40 error 404 1. name can no longer contain capital letters
41 error 404 Note that you can also install from a
42 error 404 tarball, folder, http url, or git url.
43 verbose exit [ 1, true ]
......@@ -6,6 +6,7 @@
"start": "node ./bin/www"
},
"dependencies": {
"async": "^2.6.0",
"bcrypt-nodejs": "0.0.3",
"body-parser": "~1.18.2",
"casperjs": "^1.1.4",
......
......@@ -17,8 +17,8 @@ passport.use(new KakaoStrategy({
console.log("(!)로그인 : " + profile._json.id+"("+profile._json.properties.nickname +")");
return done(null, {
'user_id': profile.auth_id,
'nickname': profile.auth_name
'user_id': profile._json.id,
'nickname': profile._json.properties.nickname
});
}
));
......
var express = require('express');
var cheerio = require('cheerio');
var request = require('request');
var async = require('async');
var router = express.Router();
updatedToons = getUpdatedToons();
function getUpdatedToons(){
function getUpdatedToons(cb){
var allToons = new Array();
var allToonsUrl = "http://comic.naver.com/webtoon/weekday.nhn";
request(allToonsUrl, function(err, res, html){
if(!err){
var $ = cheerio.load(html);
$(".thumb").has('.ico_updt').next().each(function() {
var p = Promise.resolve();
var eachs = $(".thumb").has('.ico_updt').next().each(function() {
p = p.then(function() {
var link = $(this);
var toonName = link.text();
var toonHref = link.attr('href');
allToons[toonName]=toonHref;
allToons[toonName] = toonHref;
//connection.query("");
});
});
p.then(function(){
cb(allToons);
});
}else{
console.log("업데이트 웹툰 못가져왔습니다.");
throw err;
}
});
return allToons;
}
function getMyToons(id){
var sql = "";
connection.query('SELECT * FROM user u, user_toon_relation ur WHERE u.id=ur.user_id && id=?;');
function getMyToons(id,cb){
var sqlquery = 'SELECT name, thum_link, webtoon_link, week, last FROM user u, user_toon_relation ur, toon t WHERE u.id=? && u.id=ur.user_id && t.toon_index=ur.toon_index;';
var mylist;
connection.query(sqlquery,id,function(err,rows,result){
if(!err){
mylist=rows;
cb(mylist);
}else{
console.log("내 웹툰 리스트 가져오는데 실패했습니다!");
throw err;
}
});
}
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('mytoons',{
list : updatedToons
async.series(
[
function(callback){
getMyToons(req.user.user_id, function (mytoon_list) {
callback(null,mytoon_list);
});
},
function(callback){
getUpdatedToons(function (updated_list) {
callback(null,updated_list);
});
}
],
function(err, results){
console.log(results);
res.render('mytoons', {
mytoons: results[0],
updatedtoons: results[1]
});
}
);
});
module.exports = router;
\ No newline at end of file
......
......@@ -26,7 +26,7 @@
<% } %>
<td>
<a href="<%= A.webtoon_link %>">
<img src="<%= A.thum_link %>"/>
<img alt="img" width="83" height="90" src="<%= A.thum_link %>"/>
</a>
<%= A.name %>
</td>
......
......@@ -10,15 +10,16 @@
<p>추가한 리스트</p>
<a href="/auth/logout/kakao">로그아웃</a>
<a href="/setting">세팅</a>
<a href="/setting/">세팅</a>
</br>
<table>
<%
var current = "";
for(updated in list){
for(i=0;i<mytoons.length; i++){
%>
<%= updated + " : " + list[updated] %><br>
<%= mytoons[i].name + " : " + mytoons[i].week %><br>
<%
}
%>
......
......@@ -11,8 +11,8 @@
<%
var current = "";
for(toonName in list) {
var A = list[toonName];
for(toonName in mytoons) {
var A = mytoons[toonName];
%>
<%= A %></br>
<%
......