dckat

카페 리스트 API 호출

1 +###초기설정
2 +>####데이터 베이스 설정
3 +> <pre><code>
4 +>CREATE TABLE USER(
5 +>ID int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
6 +>EMAIL varchar(64) NOT NULL UNIQUE,
7 +>NAME varchar(64) NOT NULL,
8 +>NICKNAME varchar(32) UNIQUE,
9 +>AGE varchar(32),
10 +>GENDER varchar(32)
11 +>);
12 +</code>
13 +</pre>
14 +
15 +###commit 형식
16 +<pre><code>
17 +##### 제목 - 50자 이내로 요약!
18 +
19 +### [커밋 타입]: [작업내용]
20 +
21 +##### 본문 - 한 줄에 최대 72 글자까지만 입력하기
22 +
23 +# 1. 무엇을 수정했는지
24 +# 2. 왜 수정했는지
25 +
26 +# 꼬릿말은 아래에 작성: ex) #이슈 번호
27 +-
28 +# [커밋 타입] 리스트
29 +# feat : 기능 (새로운 기능)
30 +# fix : 버그 (버그 수정)
31 +# refactor : 리팩토링
32 +# style : 스타일 (코드 형식, 세미콜론 추가: 비즈니스 로직에 변경 없음)
33 +# docs : 문서 (문서 추가, 수정, 삭제)
34 +# test : 테스트 (테스트 코드 추가, 수정, 삭제: 비즈니스 로직에 변경 없음)
35 +# chore : 기타 변경사항 (빌드 스크립트 수정 등)
36 +# post : 블로그 포스트 추가 (신규 포스트 작성 및 수정)
37 +# ------------------
38 +# [체크리스트]
39 +# 제목 첫 글자는 대문자로 작성했나요?
40 +</code>
41 +</pre>
42 +
43 +
...@@ -216,20 +216,49 @@ ...@@ -216,20 +216,49 @@
216 "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" 216 "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA=="
217 }, 217 },
218 "body-parser": { 218 "body-parser": {
219 - "version": "1.18.3", 219 + "version": "1.19.0",
220 - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", 220 + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
221 - "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", 221 + "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
222 "requires": { 222 "requires": {
223 - "bytes": "3.0.0", 223 + "bytes": "3.1.0",
224 "content-type": "~1.0.4", 224 "content-type": "~1.0.4",
225 "debug": "2.6.9", 225 "debug": "2.6.9",
226 "depd": "~1.1.2", 226 "depd": "~1.1.2",
227 - "http-errors": "~1.6.3", 227 + "http-errors": "1.7.2",
228 - "iconv-lite": "0.4.23", 228 + "iconv-lite": "0.4.24",
229 "on-finished": "~2.3.0", 229 "on-finished": "~2.3.0",
230 - "qs": "6.5.2", 230 + "qs": "6.7.0",
231 - "raw-body": "2.3.3", 231 + "raw-body": "2.4.0",
232 - "type-is": "~1.6.16" 232 + "type-is": "~1.6.17"
233 + },
234 + "dependencies": {
235 + "http-errors": {
236 + "version": "1.7.2",
237 + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
238 + "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
239 + "requires": {
240 + "depd": "~1.1.2",
241 + "inherits": "2.0.3",
242 + "setprototypeof": "1.1.1",
243 + "statuses": ">= 1.5.0 < 2",
244 + "toidentifier": "1.0.0"
245 + }
246 + },
247 + "qs": {
248 + "version": "6.7.0",
249 + "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
250 + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
251 + },
252 + "setprototypeof": {
253 + "version": "1.1.1",
254 + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
255 + "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
256 + },
257 + "statuses": {
258 + "version": "1.5.0",
259 + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
260 + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
261 + }
233 } 262 }
234 }, 263 },
235 "boxen": { 264 "boxen": {
...@@ -315,9 +344,9 @@ ...@@ -315,9 +344,9 @@
315 "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" 344 "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk="
316 }, 345 },
317 "bytes": { 346 "bytes": {
318 - "version": "3.0.0", 347 + "version": "3.1.0",
319 - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", 348 + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
320 - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" 349 + "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
321 }, 350 },
322 "cacheable-request": { 351 "cacheable-request": {
323 "version": "6.1.0", 352 "version": "6.1.0",
...@@ -651,10 +680,51 @@ ...@@ -651,10 +680,51 @@
651 "vary": "~1.1.2" 680 "vary": "~1.1.2"
652 }, 681 },
653 "dependencies": { 682 "dependencies": {
683 + "body-parser": {
684 + "version": "1.18.3",
685 + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz",
686 + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=",
687 + "requires": {
688 + "bytes": "3.0.0",
689 + "content-type": "~1.0.4",
690 + "debug": "2.6.9",
691 + "depd": "~1.1.2",
692 + "http-errors": "~1.6.3",
693 + "iconv-lite": "0.4.23",
694 + "on-finished": "~2.3.0",
695 + "qs": "6.5.2",
696 + "raw-body": "2.3.3",
697 + "type-is": "~1.6.16"
698 + }
699 + },
700 + "bytes": {
701 + "version": "3.0.0",
702 + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
703 + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg="
704 + },
654 "cookie": { 705 "cookie": {
655 "version": "0.3.1", 706 "version": "0.3.1",
656 "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", 707 "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
657 "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" 708 "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
709 + },
710 + "iconv-lite": {
711 + "version": "0.4.23",
712 + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
713 + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
714 + "requires": {
715 + "safer-buffer": ">= 2.1.2 < 3"
716 + }
717 + },
718 + "raw-body": {
719 + "version": "2.3.3",
720 + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz",
721 + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==",
722 + "requires": {
723 + "bytes": "3.0.0",
724 + "http-errors": "1.6.3",
725 + "iconv-lite": "0.4.23",
726 + "unpipe": "1.0.0"
727 + }
658 } 728 }
659 } 729 }
660 }, 730 },
...@@ -966,9 +1036,9 @@ ...@@ -966,9 +1036,9 @@
966 } 1036 }
967 }, 1037 },
968 "iconv-lite": { 1038 "iconv-lite": {
969 - "version": "0.4.23", 1039 + "version": "0.4.24",
970 - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", 1040 + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
971 - "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", 1041 + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
972 "requires": { 1042 "requires": {
973 "safer-buffer": ">= 2.1.2 < 3" 1043 "safer-buffer": ">= 2.1.2 < 3"
974 } 1044 }
...@@ -1081,10 +1151,17 @@ ...@@ -1081,10 +1151,17 @@
1081 "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", 1151 "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz",
1082 "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==" 1152 "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw=="
1083 }, 1153 },
1154 +<<<<<<< HEAD
1084 "isstream": { 1155 "isstream": {
1085 "version": "0.1.2", 1156 "version": "0.1.2",
1086 "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", 1157 "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
1087 "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" 1158 "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
1159 +=======
1160 + "isarray": {
1161 + "version": "1.0.0",
1162 + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
1163 + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
1164 +>>>>>>> 725445bde095435f47f8bc948873818794f00365
1088 }, 1165 },
1089 "jake": { 1166 "jake": {
1090 "version": "10.8.2", 1167 "version": "10.8.2",
...@@ -1293,6 +1370,24 @@ ...@@ -1293,6 +1370,24 @@
1293 "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 1370 "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
1294 "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 1371 "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
1295 }, 1372 },
1373 + "mysql": {
1374 + "version": "2.18.1",
1375 + "resolved": "https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz",
1376 + "integrity": "sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig==",
1377 + "requires": {
1378 + "bignumber.js": "9.0.0",
1379 + "readable-stream": "2.3.7",
1380 + "safe-buffer": "5.1.2",
1381 + "sqlstring": "2.3.1"
1382 + },
1383 + "dependencies": {
1384 + "bignumber.js": {
1385 + "version": "9.0.0",
1386 + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
1387 + "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A=="
1388 + }
1389 + }
1390 + },
1296 "negotiator": { 1391 "negotiator": {
1297 "version": "0.6.2", 1392 "version": "0.6.2",
1298 "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", 1393 "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
...@@ -1437,6 +1532,11 @@ ...@@ -1437,6 +1532,11 @@
1437 "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", 1532 "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz",
1438 "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" 1533 "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc="
1439 }, 1534 },
1535 + "process-nextick-args": {
1536 + "version": "2.0.1",
1537 + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
1538 + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
1539 + },
1440 "proxy-addr": { 1540 "proxy-addr": {
1441 "version": "2.0.6", 1541 "version": "2.0.6",
1442 "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", 1542 "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz",
...@@ -1494,14 +1594,38 @@ ...@@ -1494,14 +1594,38 @@
1494 "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" 1594 "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
1495 }, 1595 },
1496 "raw-body": { 1596 "raw-body": {
1497 - "version": "2.3.3", 1597 + "version": "2.4.0",
1498 - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", 1598 + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
1499 - "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", 1599 + "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
1500 "requires": { 1600 "requires": {
1501 - "bytes": "3.0.0", 1601 + "bytes": "3.1.0",
1502 - "http-errors": "1.6.3", 1602 + "http-errors": "1.7.2",
1503 - "iconv-lite": "0.4.23", 1603 + "iconv-lite": "0.4.24",
1504 "unpipe": "1.0.0" 1604 "unpipe": "1.0.0"
1605 + },
1606 + "dependencies": {
1607 + "http-errors": {
1608 + "version": "1.7.2",
1609 + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
1610 + "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
1611 + "requires": {
1612 + "depd": "~1.1.2",
1613 + "inherits": "2.0.3",
1614 + "setprototypeof": "1.1.1",
1615 + "statuses": ">= 1.5.0 < 2",
1616 + "toidentifier": "1.0.0"
1617 + }
1618 + },
1619 + "setprototypeof": {
1620 + "version": "1.1.1",
1621 + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
1622 + "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
1623 + },
1624 + "statuses": {
1625 + "version": "1.5.0",
1626 + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
1627 + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
1628 + }
1505 } 1629 }
1506 }, 1630 },
1507 "rc": { 1631 "rc": {
...@@ -1515,6 +1639,20 @@ ...@@ -1515,6 +1639,20 @@
1515 "strip-json-comments": "~2.0.1" 1639 "strip-json-comments": "~2.0.1"
1516 } 1640 }
1517 }, 1641 },
1642 + "readable-stream": {
1643 + "version": "2.3.7",
1644 + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
1645 + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
1646 + "requires": {
1647 + "core-util-is": "~1.0.0",
1648 + "inherits": "~2.0.3",
1649 + "isarray": "~1.0.0",
1650 + "process-nextick-args": "~2.0.0",
1651 + "safe-buffer": "~5.1.1",
1652 + "string_decoder": "~1.1.1",
1653 + "util-deprecate": "~1.0.1"
1654 + }
1655 + },
1518 "readdirp": { 1656 "readdirp": {
1519 "version": "3.5.0", 1657 "version": "3.5.0",
1520 "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", 1658 "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz",
...@@ -1678,6 +1816,10 @@ ...@@ -1678,6 +1816,10 @@
1678 "safer-buffer": "^2.0.2", 1816 "safer-buffer": "^2.0.2",
1679 "tweetnacl": "~0.14.0" 1817 "tweetnacl": "~0.14.0"
1680 } 1818 }
1819 + "sqlstring": {
1820 + "version": "2.3.1",
1821 + "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz",
1822 + "integrity": "sha1-R1OT/56RR5rqYtyvDKPRSYOn+0A="
1681 }, 1823 },
1682 "statuses": { 1824 "statuses": {
1683 "version": "1.4.0", 1825 "version": "1.4.0",
...@@ -1719,6 +1861,14 @@ ...@@ -1719,6 +1861,14 @@
1719 } 1861 }
1720 } 1862 }
1721 }, 1863 },
1864 + "string_decoder": {
1865 + "version": "1.1.1",
1866 + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
1867 + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
1868 + "requires": {
1869 + "safe-buffer": "~5.1.0"
1870 + }
1871 + },
1722 "strip-ansi": { 1872 "strip-ansi": {
1723 "version": "5.2.0", 1873 "version": "5.2.0",
1724 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", 1874 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
...@@ -1758,6 +1908,11 @@ ...@@ -1758,6 +1908,11 @@
1758 "is-number": "^7.0.0" 1908 "is-number": "^7.0.0"
1759 } 1909 }
1760 }, 1910 },
1911 + "toidentifier": {
1912 + "version": "1.0.0",
1913 + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
1914 + "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
1915 + },
1761 "touch": { 1916 "touch": {
1762 "version": "3.1.0", 1917 "version": "3.1.0",
1763 "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", 1918 "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz",
...@@ -1925,6 +2080,11 @@ ...@@ -1925,6 +2080,11 @@
1925 "prepend-http": "^2.0.0" 2080 "prepend-http": "^2.0.0"
1926 } 2081 }
1927 }, 2082 },
2083 + "util-deprecate": {
2084 + "version": "1.0.2",
2085 + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
2086 + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
2087 + },
1928 "utils-merge": { 2088 "utils-merge": {
1929 "version": "1.0.1", 2089 "version": "1.0.1",
1930 "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 2090 "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
6 "start": "nodemon ./bin/www" 6 "start": "nodemon ./bin/www"
7 }, 7 },
8 "dependencies": { 8 "dependencies": {
9 + "body-parser": "^1.19.0",
9 "cookie-parser": "~1.4.4", 10 "cookie-parser": "~1.4.4",
10 "debug": "~2.6.9", 11 "debug": "~2.6.9",
11 "ejs": "^3.1.6", 12 "ejs": "^3.1.6",
...@@ -14,6 +15,7 @@ ...@@ -14,6 +15,7 @@
14 "google-auth-library": "^7.0.4", 15 "google-auth-library": "^7.0.4",
15 "http-errors": "~1.6.3", 16 "http-errors": "~1.6.3",
16 "morgan": "~1.9.1", 17 "morgan": "~1.9.1",
18 + "mysql": "^2.18.1",
17 "nodemon": "^2.0.7", 19 "nodemon": "^2.0.7",
18 "request": "^2.88.2", 20 "request": "^2.88.2",
19 "session-file-store": "^1.5.0" 21 "session-file-store": "^1.5.0"
......
1 var express = require("express"); 1 var express = require("express");
2 var router = express.Router(); 2 var router = express.Router();
3 +
3 var request = require("request"); 4 var request = require("request");
5 +var bodyParser=require('body-parser');
4 6
5 var { OAuth2Client } = require("google-auth-library"); 7 var { OAuth2Client } = require("google-auth-library");
6 var querystring = require("querystring"); 8 var querystring = require("querystring");
...@@ -8,8 +10,11 @@ var querystring = require("querystring"); ...@@ -8,8 +10,11 @@ var querystring = require("querystring");
8 var CLIENT_ID = 10 var CLIENT_ID =
9 "94679084723-s5f0686p2porp9mkakrp1p89a48n24nj.apps.googleusercontent.com"; 11 "94679084723-s5f0686p2porp9mkakrp1p89a48n24nj.apps.googleusercontent.com";
10 var client = new OAuth2Client(CLIENT_ID); 12 var client = new OAuth2Client(CLIENT_ID);
13 +var mysql=require('mysql')
11 var session = require("express-session"); 14 var session = require("express-session");
12 var FileStore = require("session-file-store")(session); 15 var FileStore = require("session-file-store")(session);
16 +router.use(bodyParser.urlencoded({extended:false})); //url인코딩 x
17 +router.use(bodyParser.json()); //json방식으로 파
13 router.use( 18 router.use(
14 session({ 19 session({
15 secret: "209", // 암호화 20 secret: "209", // 암호화
...@@ -18,7 +23,13 @@ router.use( ...@@ -18,7 +23,13 @@ router.use(
18 store: new FileStore(), 23 store: new FileStore(),
19 }) 24 })
20 ); 25 );
21 - 26 +var connection = mysql.createConnection({
27 + host : 'localhost',
28 + user : 'root',
29 + password : 'g79465',
30 + database : 'caferecommend'
31 +});
32 +connection.connect();
22 /* GET home page. */ 33 /* GET home page. */
23 router.get("/", function (req, res, next) { 34 router.get("/", function (req, res, next) {
24 res.render("index", { 35 res.render("index", {
...@@ -48,16 +59,60 @@ router.post("/index", (req, res) => { ...@@ -48,16 +59,60 @@ router.post("/index", (req, res) => {
48 }); 59 });
49 60
50 router.get("/login", checkAuthenticated, (req, res) => { 61 router.get("/login", checkAuthenticated, (req, res) => {
51 - let user = req.user; 62 + var sql = 'SELECT * FROM USER WHERE EMAIL=?';
52 - req.session.user = user; 63 + var parameter=[req.session.user.email];
53 - res.render("login", { user: req.session.user }); 64 + connection.query(sql,parameter, function(err, row){
65 + if(err){
66 + console.log(err);
67 + }
68 + else {
69 + if (row.length > 0) {
70 + console.log("이미 가입이 되어있는 아이디")
71 + req.session.user.nickname = row[0].NICKNAME;
72 + req.session.user.age = row[0].AGE;
73 + req.session.user.gender = row[0].GENDER;
74 + return res.render('map', {user : req.session.user})
75 + }
76 + else{
77 + return res.render("login", { user: req.session.user, message:'none' });
78 + }
79 + }
80 + });
54 }); 81 });
55 82
56 router.post("/login", (req, res) => { 83 router.post("/login", (req, res) => {
57 console.log(req.body.nickname); 84 console.log(req.body.nickname);
58 console.log(req.body.age); 85 console.log(req.body.age);
59 console.log(req.body.gender); 86 console.log(req.body.gender);
60 - return res.render("login", { user: req.session.user }); 87 + var sql =' SELECT * FROM USER WHERE NICKNAME=?';
88 + var parameter=[req.body.nickname];
89 + connection.query(sql, parameter, function(err,row){
90 + if(err){
91 + console.log(err);
92 + }
93 + if(row.length>0){
94 + console.log('동일 닉네임있음');
95 +
96 + return res.render("login", {user : req.session.user, message: 'same nickname'});
97 + }
98 + else{
99 + req.session.user.nickname=req.body.nickname;
100 + req.session.user.age=req.body.age;
101 + req.session.user.gender=req.body.gender;
102 + var sql='INSERT INTO USER(EMAIL, NAME, NICKNAME, AGE, GENDER) VALUES(?,?,?,?,?)';
103 + var parameter=[req.session.user.email, req.session.user.name, req.session.user.nickname, req.session.user.age, req.session.user.gender];
104 + connection.query(sql, parameter, function(err, row){
105 + if(err){
106 + console.log(err);
107 + }
108 + else{
109 + console.log("새로운 user데이터 입력");
110 + }
111 + });
112 + return res.render("map", { user : req.session.user });
113 + }
114 + });
115 +
61 }); 116 });
62 117
63 router.get("/cafe", (req, res) => { 118 router.get("/cafe", (req, res) => {
...@@ -104,15 +159,28 @@ function checkAuthenticated(req, res, next) { ...@@ -104,15 +159,28 @@ function checkAuthenticated(req, res, next) {
104 const payload = ticket.getPayload(); 159 const payload = ticket.getPayload();
105 user.name = payload.name; 160 user.name = payload.name;
106 user.email = payload.email; 161 user.email = payload.email;
107 - user.picture = payload.picture;
108 - console.log(user.name);
109 } 162 }
110 verify() 163 verify()
111 .then(() => { 164 .then(() => {
112 - req.user = user; 165 + req.session.user.name = user.name;
166 + req.session.user.email=user.email;
113 next(); 167 next();
114 }) 168 })
115 .catch((err) => { 169 .catch((err) => {
116 res.redirect("/index"); 170 res.redirect("/index");
117 }); 171 });
118 } 172 }
173 +<<<<<<< HEAD
174 +=======
175 +
176 +router.get("/map", (req, res) => {
177 + console.log(req.session.user);
178 + res.render("map");
179 +});
180 +
181 +
182 +router.get('/logout',function(req,res){
183 + req.session.destroy(); //세션비우기
184 + res.redirect('/');
185 +});
186 +>>>>>>> 725445bde095435f47f8bc948873818794f00365
......
1 +{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"__lastAccess":1621187236305}
...\ No newline at end of file ...\ No newline at end of file
1 -{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"__lastAccess":1620823546959,"user":{"name":"‍김대철[학생](소프트웨어융합대학 컴퓨터공학과)","email":"kdc9619@khu.ac.kr","picture":"https://lh3.googleusercontent.com/a/AATXAJyP14ipRboJZ8T5-oNS3sRp4CG8wKCEwVABQ5G_=s96-c"}}
...\ No newline at end of file ...\ No newline at end of file
1 -{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"__lastAccess":1620684562564,"user":{"name":"‍최정민[학생](소프트웨어융합대학 컴퓨터공학과)","email":"cjm2021401@khu.ac.kr","picture":"https://lh3.googleusercontent.com/a/AATXAJzFD3R6CaL2NpysVrfvdGqcQ83vh_wpbN_5hj-0=s96-c"}}
...\ No newline at end of file ...\ No newline at end of file
1 +{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"__lastAccess":1621186188104}
...\ No newline at end of file ...\ No newline at end of file
1 +{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"__lastAccess":1621191395860,"user":{"name":"‍최정민[학생](소프트웨어융합대학 컴퓨터공학과)","email":"cjm2021401@khu.ac.kr","nickname":"Mayf","age":"25","gender":"male"},"gender":"male"}
...\ No newline at end of file ...\ No newline at end of file
...@@ -22,8 +22,15 @@ ...@@ -22,8 +22,15 @@
22 22
23 <input type="submit" value="Submit"> 23 <input type="submit" value="Submit">
24 </form> 24 </form>
25 -<a href="/index" onclick="signOut();">Sign Out</a> 25 +<a href="/logout" onclick="signOut();">Sign Out</a>
26 +<%if (message=='same nickname'){%>
27 + <script type="text/javascript">
26 28
29 + alert("입력하신 NICKNAME은 사용하지 못합니다." +
30 + "다른 NICKNAME을 입력하여 주세요");
31 +
32 + </script>
33 +<%}%>
27 34
28 </body> 35 </body>
29 <script> 36 <script>
......