Showing
18 changed files
with
648 additions
and
19 deletions
LICENSE.txt
deleted
100644 → 0
| 1 | -MIT License | ||
| 2 | -Copyright (c) 2022 Jeongmin Seo | ||
| 3 | -Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 4 | -of this software and associated documentation files (the "Software"), to deal | ||
| 5 | -in the Software without restriction, including without limitation the rights | ||
| 6 | -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 7 | -copies of the Software, and to permit persons to whom the Software is | ||
| 8 | -furnished to do so, subject to the following conditions: | ||
| 9 | -The above copyright notice and this permission notice shall be included in all | ||
| 10 | -copies or substantial portions of the Software. | ||
| 11 | -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 12 | -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 13 | -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 14 | -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 15 | -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 16 | -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 17 | -SOFTWARE. | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -115,4 +115,10 @@ dist | ... | @@ -115,4 +115,10 @@ dist |
| 115 | .yarn/unplugged | 115 | .yarn/unplugged |
| 116 | .yarn/build-state.yml | 116 | .yarn/build-state.yml |
| 117 | .yarn/install-state.gz | 117 | .yarn/install-state.gz |
| 118 | -.pnp.* | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 118 | +<<<<<<< HEAD | ||
| 119 | +.pnp.* | ||
| 120 | +======= | ||
| 121 | +.pnp.* | ||
| 122 | + | ||
| 123 | +.package-lock.json | ||
| 124 | +>>>>>>> release_v0.2.0 | ... | ... |
| ... | @@ -5,6 +5,7 @@ const bodyParser = require("body-parser"); | ... | @@ -5,6 +5,7 @@ const bodyParser = require("body-parser"); |
| 5 | //환경변수 (운영체제간 gap 없애고자) | 5 | //환경변수 (운영체제간 gap 없애고자) |
| 6 | const dotenv = require("dotenv"); | 6 | const dotenv = require("dotenv"); |
| 7 | dotenv.config(); | 7 | dotenv.config(); |
| 8 | +<<<<<<< HEAD | ||
| 8 | 9 | ||
| 9 | const compression = require("compression"); | 10 | const compression = require("compression"); |
| 10 | const methodOverride = require("method-override"); | 11 | const methodOverride = require("method-override"); |
| ... | @@ -18,23 +19,68 @@ const home = require("./src/routes/home"); | ... | @@ -18,23 +19,68 @@ const home = require("./src/routes/home"); |
| 18 | const port = 3000; | 19 | const port = 3000; |
| 19 | 20 | ||
| 20 | const jwtMiddleware = require("./src/config/jwtMiddleware"); | 21 | const jwtMiddleware = require("./src/config/jwtMiddleware"); |
| 22 | +======= | ||
| 23 | +const compression = require("compression"); | ||
| 24 | +const methodOverride = require("method-override"); | ||
| 25 | +const path = require("path") | ||
| 26 | +const socketIO = require("socket.io") | ||
| 27 | +const moment = require("moment") | ||
| 28 | +const http = require("http"); | ||
| 29 | +const app = express(); | ||
| 30 | +const server = http.createServer(app); | ||
| 31 | + | ||
| 32 | +var cors = require("cors"); | ||
| 33 | +const { logger } = require("./src/config/winston"); | ||
| 34 | +//app이라는 express 객체 생성 | ||
| 35 | +//라우팅 | ||
| 36 | +const home = require("./src/routes/home"); | ||
| 37 | +const port = 3000; | ||
| 38 | +const jwtMiddleware = require("./src/config/jwtMiddleware"); | ||
| 39 | +const io = socketIO(server); | ||
| 40 | +>>>>>>> release_v0.2.0 | ||
| 21 | 41 | ||
| 22 | // 앱 세팅 | 42 | // 앱 세팅 |
| 23 | app.set("views", "./src/views"); | 43 | app.set("views", "./src/views"); |
| 24 | app.set("view engine", "ejs"); | 44 | app.set("view engine", "ejs"); |
| 25 | app.use(express.static(`${__dirname}/src/public`)); | 45 | app.use(express.static(`${__dirname}/src/public`)); |
| 46 | +<<<<<<< HEAD | ||
| 47 | +app.use(bodyParser.json()); | ||
| 48 | +//url통해 전달되는 데이터에 한글, 공백 등의 문자 오류 해결 | ||
| 49 | +app.use(bodyParser.urlencoded({extended: true})); | ||
| 50 | +======= | ||
| 51 | +app.use(express.static(path.join(__dirname, "src"))) | ||
| 52 | + | ||
| 26 | app.use(bodyParser.json()); | 53 | app.use(bodyParser.json()); |
| 27 | //url통해 전달되는 데이터에 한글, 공백 등의 문자 오류 해결 | 54 | //url통해 전달되는 데이터에 한글, 공백 등의 문자 오류 해결 |
| 28 | app.use(bodyParser.urlencoded({extended: true})); | 55 | app.use(bodyParser.urlencoded({extended: true})); |
| 56 | + | ||
| 57 | +>>>>>>> release_v0.2.0 | ||
| 29 | app.use(compression()); // HTTP 요청을 압축 및 해제 | 58 | app.use(compression()); // HTTP 요청을 압축 및 해제 |
| 30 | app.use(express.json()); | 59 | app.use(express.json()); |
| 31 | app.use(express.urlencoded({ extended: true })); | 60 | app.use(express.urlencoded({ extended: true })); |
| 32 | app.use(methodOverride()); | 61 | app.use(methodOverride()); |
| 33 | app.use(cors()); | 62 | app.use(cors()); |
| 34 | // app.use("/restaurants", require("../app/src/routes/home/restaurant.route")); | 63 | // app.use("/restaurants", require("../app/src/routes/home/restaurant.route")); |
| 64 | +<<<<<<< HEAD | ||
| 35 | require("../app/src/routes/home/restaurant.route")(app); | 65 | require("../app/src/routes/home/restaurant.route")(app); |
| 36 | 66 | ||
| 37 | app.use("/", home); //미들웨어 등록해주는 method | 67 | app.use("/", home); //미들웨어 등록해주는 method |
| 68 | +======= | ||
| 69 | +// require("../app/src/routes/home/restaurant.route")(app); | ||
| 70 | + | ||
| 71 | +app.use("/", home); //미들웨어 등록해주는 method | ||
| 72 | + | ||
| 73 | +io.on('connection', (socket) => { | ||
| 74 | + socket.on("chatting", (data)=>{ | ||
| 75 | + const { name, msg } = data; | ||
| 76 | + io.emit("chatting", { | ||
| 77 | + name, | ||
| 78 | + msg, | ||
| 79 | + time : moment(new Date()).format("h:ss A")}) | ||
| 80 | + }) | ||
| 81 | +}); | ||
| 82 | + | ||
| 83 | +>>>>>>> release_v0.2.0 | ||
| 38 | logger.info(`${process.env.NODE_ENV} - API Server Start At Port ${port}`); | 84 | logger.info(`${process.env.NODE_ENV} - API Server Start At Port ${port}`); |
| 39 | 85 | ||
| 40 | module.exports = app; | 86 | module.exports = app; |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -19,6 +19,24 @@ | ... | @@ -19,6 +19,24 @@ |
| 19 | "kuler": "^2.0.0" | 19 | "kuler": "^2.0.0" |
| 20 | } | 20 | } |
| 21 | }, | 21 | }, |
| 22 | +<<<<<<< HEAD | ||
| 23 | +======= | ||
| 24 | + "@types/component-emitter": { | ||
| 25 | + "version": "1.2.11", | ||
| 26 | + "resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz", | ||
| 27 | + "integrity": "sha512-SRXjM+tfsSlA9VuG8hGO2nft2p8zjXCK1VcC6N4NXbBbYbSia9kzCChYQajIjzIqOOOuh5Ock6MmV2oux4jDZQ==" | ||
| 28 | + }, | ||
| 29 | + "@types/cookie": { | ||
| 30 | + "version": "0.4.1", | ||
| 31 | + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz", | ||
| 32 | + "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==" | ||
| 33 | + }, | ||
| 34 | + "@types/cors": { | ||
| 35 | + "version": "2.8.12", | ||
| 36 | + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.12.tgz", | ||
| 37 | + "integrity": "sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw==" | ||
| 38 | + }, | ||
| 39 | +>>>>>>> release_v0.2.0 | ||
| 22 | "@types/mysql": { | 40 | "@types/mysql": { |
| 23 | "version": "2.15.21", | 41 | "version": "2.15.21", |
| 24 | "resolved": "https://registry.npmjs.org/@types/mysql/-/mysql-2.15.21.tgz", | 42 | "resolved": "https://registry.npmjs.org/@types/mysql/-/mysql-2.15.21.tgz", |
| ... | @@ -103,6 +121,14 @@ | ... | @@ -103,6 +121,14 @@ |
| 103 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", | 121 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", |
| 104 | "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" | 122 | "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" |
| 105 | }, | 123 | }, |
| 124 | +<<<<<<< HEAD | ||
| 125 | +======= | ||
| 126 | + "base64id": { | ||
| 127 | + "version": "2.0.0", | ||
| 128 | + "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", | ||
| 129 | + "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==" | ||
| 130 | + }, | ||
| 131 | +>>>>>>> release_v0.2.0 | ||
| 106 | "bcrypt-pbkdf": { | 132 | "bcrypt-pbkdf": { |
| 107 | "version": "1.0.2", | 133 | "version": "1.0.2", |
| 108 | "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", | 134 | "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", |
| ... | @@ -239,6 +265,14 @@ | ... | @@ -239,6 +265,14 @@ |
| 239 | "delayed-stream": "~1.0.0" | 265 | "delayed-stream": "~1.0.0" |
| 240 | } | 266 | } |
| 241 | }, | 267 | }, |
| 268 | +<<<<<<< HEAD | ||
| 269 | +======= | ||
| 270 | + "component-emitter": { | ||
| 271 | + "version": "1.3.0", | ||
| 272 | + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", | ||
| 273 | + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" | ||
| 274 | + }, | ||
| 275 | +>>>>>>> release_v0.2.0 | ||
| 242 | "compressible": { | 276 | "compressible": { |
| 243 | "version": "2.0.18", | 277 | "version": "2.0.18", |
| 244 | "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", | 278 | "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", |
| ... | @@ -406,6 +440,51 @@ | ... | @@ -406,6 +440,51 @@ |
| 406 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", | 440 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", |
| 407 | "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" | 441 | "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" |
| 408 | }, | 442 | }, |
| 443 | +<<<<<<< HEAD | ||
| 444 | +======= | ||
| 445 | + "engine.io": { | ||
| 446 | + "version": "6.2.0", | ||
| 447 | + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.2.0.tgz", | ||
| 448 | + "integrity": "sha512-4KzwW3F3bk+KlzSOY57fj/Jx6LyRQ1nbcyIadehl+AnXjKT7gDO0ORdRi/84ixvMKTym6ZKuxvbzN62HDDU1Lg==", | ||
| 449 | + "requires": { | ||
| 450 | + "@types/cookie": "^0.4.1", | ||
| 451 | + "@types/cors": "^2.8.12", | ||
| 452 | + "@types/node": ">=10.0.0", | ||
| 453 | + "accepts": "~1.3.4", | ||
| 454 | + "base64id": "2.0.0", | ||
| 455 | + "cookie": "~0.4.1", | ||
| 456 | + "cors": "~2.8.5", | ||
| 457 | + "debug": "~4.3.1", | ||
| 458 | + "engine.io-parser": "~5.0.3", | ||
| 459 | + "ws": "~8.2.3" | ||
| 460 | + }, | ||
| 461 | + "dependencies": { | ||
| 462 | + "cookie": { | ||
| 463 | + "version": "0.4.2", | ||
| 464 | + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", | ||
| 465 | + "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==" | ||
| 466 | + }, | ||
| 467 | + "debug": { | ||
| 468 | + "version": "4.3.4", | ||
| 469 | + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", | ||
| 470 | + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", | ||
| 471 | + "requires": { | ||
| 472 | + "ms": "2.1.2" | ||
| 473 | + } | ||
| 474 | + }, | ||
| 475 | + "ms": { | ||
| 476 | + "version": "2.1.2", | ||
| 477 | + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", | ||
| 478 | + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" | ||
| 479 | + } | ||
| 480 | + } | ||
| 481 | + }, | ||
| 482 | + "engine.io-parser": { | ||
| 483 | + "version": "5.0.4", | ||
| 484 | + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.4.tgz", | ||
| 485 | + "integrity": "sha512-+nVFp+5z1E3HcToEnO7ZIj3g+3k9389DvWtvJZz0T6/eOCPIyyxehFcedoYrZQrp0LgQbD9pPXhpMBKMd5QURg==" | ||
| 486 | + }, | ||
| 487 | +>>>>>>> release_v0.2.0 | ||
| 409 | "escape-html": { | 488 | "escape-html": { |
| 410 | "version": "1.0.3", | 489 | "version": "1.0.3", |
| 411 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", | 490 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", |
| ... | @@ -1255,6 +1334,67 @@ | ... | @@ -1255,6 +1334,67 @@ |
| 1255 | "is-arrayish": "^0.3.1" | 1334 | "is-arrayish": "^0.3.1" |
| 1256 | } | 1335 | } |
| 1257 | }, | 1336 | }, |
| 1337 | +<<<<<<< HEAD | ||
| 1338 | +======= | ||
| 1339 | + "socket.io": { | ||
| 1340 | + "version": "4.5.1", | ||
| 1341 | + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.5.1.tgz", | ||
| 1342 | + "integrity": "sha512-0y9pnIso5a9i+lJmsCdtmTTgJFFSvNQKDnPQRz28mGNnxbmqYg2QPtJTLFxhymFZhAIn50eHAKzJeiNaKr+yUQ==", | ||
| 1343 | + "requires": { | ||
| 1344 | + "accepts": "~1.3.4", | ||
| 1345 | + "base64id": "~2.0.0", | ||
| 1346 | + "debug": "~4.3.2", | ||
| 1347 | + "engine.io": "~6.2.0", | ||
| 1348 | + "socket.io-adapter": "~2.4.0", | ||
| 1349 | + "socket.io-parser": "~4.0.4" | ||
| 1350 | + }, | ||
| 1351 | + "dependencies": { | ||
| 1352 | + "debug": { | ||
| 1353 | + "version": "4.3.4", | ||
| 1354 | + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", | ||
| 1355 | + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", | ||
| 1356 | + "requires": { | ||
| 1357 | + "ms": "2.1.2" | ||
| 1358 | + } | ||
| 1359 | + }, | ||
| 1360 | + "ms": { | ||
| 1361 | + "version": "2.1.2", | ||
| 1362 | + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", | ||
| 1363 | + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" | ||
| 1364 | + } | ||
| 1365 | + } | ||
| 1366 | + }, | ||
| 1367 | + "socket.io-adapter": { | ||
| 1368 | + "version": "2.4.0", | ||
| 1369 | + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.4.0.tgz", | ||
| 1370 | + "integrity": "sha512-W4N+o69rkMEGVuk2D/cvca3uYsvGlMwsySWV447y99gUPghxq42BxqLNMndb+a1mm/5/7NeXVQS7RLa2XyXvYg==" | ||
| 1371 | + }, | ||
| 1372 | + "socket.io-parser": { | ||
| 1373 | + "version": "4.0.4", | ||
| 1374 | + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.0.4.tgz", | ||
| 1375 | + "integrity": "sha512-t+b0SS+IxG7Rxzda2EVvyBZbvFPBCjJoyHuE0P//7OAsN23GItzDRdWa6ALxZI/8R5ygK7jAR6t028/z+7295g==", | ||
| 1376 | + "requires": { | ||
| 1377 | + "@types/component-emitter": "^1.2.10", | ||
| 1378 | + "component-emitter": "~1.3.0", | ||
| 1379 | + "debug": "~4.3.1" | ||
| 1380 | + }, | ||
| 1381 | + "dependencies": { | ||
| 1382 | + "debug": { | ||
| 1383 | + "version": "4.3.4", | ||
| 1384 | + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", | ||
| 1385 | + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", | ||
| 1386 | + "requires": { | ||
| 1387 | + "ms": "2.1.2" | ||
| 1388 | + } | ||
| 1389 | + }, | ||
| 1390 | + "ms": { | ||
| 1391 | + "version": "2.1.2", | ||
| 1392 | + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", | ||
| 1393 | + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" | ||
| 1394 | + } | ||
| 1395 | + } | ||
| 1396 | + }, | ||
| 1397 | +>>>>>>> release_v0.2.0 | ||
| 1258 | "sqlstring": { | 1398 | "sqlstring": { |
| 1259 | "version": "2.3.1", | 1399 | "version": "2.3.1", |
| 1260 | "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz", | 1400 | "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz", |
| ... | @@ -1467,6 +1607,14 @@ | ... | @@ -1467,6 +1607,14 @@ |
| 1467 | } | 1607 | } |
| 1468 | } | 1608 | } |
| 1469 | }, | 1609 | }, |
| 1610 | +<<<<<<< HEAD | ||
| 1611 | +======= | ||
| 1612 | + "ws": { | ||
| 1613 | + "version": "8.2.3", | ||
| 1614 | + "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz", | ||
| 1615 | + "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==" | ||
| 1616 | + }, | ||
| 1617 | +>>>>>>> release_v0.2.0 | ||
| 1470 | "yallist": { | 1618 | "yallist": { |
| 1471 | "version": "4.0.0", | 1619 | "version": "4.0.0", |
| 1472 | "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", | 1620 | "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", | ... | ... |
| ... | @@ -16,10 +16,18 @@ | ... | @@ -16,10 +16,18 @@ |
| 16 | "express": "^4.18.1", | 16 | "express": "^4.18.1", |
| 17 | "jsonwebtoken": "^8.5.1", | 17 | "jsonwebtoken": "^8.5.1", |
| 18 | "method-override": "^3.0.0", | 18 | "method-override": "^3.0.0", |
| 19 | +<<<<<<< HEAD | ||
| 20 | +======= | ||
| 21 | + "moment": "^2.29.3", | ||
| 22 | +>>>>>>> release_v0.2.0 | ||
| 19 | "mysql": "^2.18.1", | 23 | "mysql": "^2.18.1", |
| 20 | "mysql2": "^2.2.0", | 24 | "mysql2": "^2.2.0", |
| 21 | "regex-email": "^1.0.2", | 25 | "regex-email": "^1.0.2", |
| 22 | "request": "^2.88.2", | 26 | "request": "^2.88.2", |
| 27 | +<<<<<<< HEAD | ||
| 28 | +======= | ||
| 29 | + "socket.io": "^4.5.1", | ||
| 30 | +>>>>>>> release_v0.2.0 | ||
| 23 | "winston": "^3.2.1", | 31 | "winston": "^3.2.1", |
| 24 | "winston-daily-rotate-file": "^4.2.1" | 32 | "winston-daily-rotate-file": "^4.2.1" |
| 25 | }, | 33 | }, |
| ... | @@ -31,7 +39,11 @@ | ... | @@ -31,7 +39,11 @@ |
| 31 | "prod": "NODE_ENV=production node index.js" | 39 | "prod": "NODE_ENV=production node index.js" |
| 32 | }, | 40 | }, |
| 33 | "author": "Jeongmin Seo, Jumi Yang", | 41 | "author": "Jeongmin Seo, Jumi Yang", |
| 42 | +<<<<<<< HEAD | ||
| 34 | "license": "ISC", | 43 | "license": "ISC", |
| 44 | +======= | ||
| 45 | + "license": "MIT", | ||
| 46 | +>>>>>>> release_v0.2.0 | ||
| 35 | "keywords": [], | 47 | "keywords": [], |
| 36 | "description": "Node.js API Server" | 48 | "description": "Node.js API Server" |
| 37 | } | 49 | } | ... | ... |
| ... | @@ -12,6 +12,7 @@ class User { | ... | @@ -12,6 +12,7 @@ class User { |
| 12 | 12 | ||
| 13 | async login() { | 13 | async login() { |
| 14 | const client = this.body; | 14 | const client = this.body; |
| 15 | +<<<<<<< HEAD | ||
| 15 | 16 | ||
| 16 | try { | 17 | try { |
| 17 | try { | 18 | try { |
| ... | @@ -36,6 +37,34 @@ class User { | ... | @@ -36,6 +37,34 @@ class User { |
| 36 | } | 37 | } |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 40 | +======= | ||
| 41 | + | ||
| 42 | + try { | ||
| 43 | + const connection = await pool.getConnection(async (conn) => conn); | ||
| 44 | + try { | ||
| 45 | + const { id, password } = await UserStorage.getUserInfo( | ||
| 46 | + connection, | ||
| 47 | + client.id | ||
| 48 | + ); | ||
| 49 | + if (id) { | ||
| 50 | + if (id === client.id && password === client.password) { | ||
| 51 | + return { success: true }; | ||
| 52 | + } | ||
| 53 | + return { success: false, msg: "비밀번호가 틀렸습니다." }; | ||
| 54 | + } | ||
| 55 | + return { success: false, msg: "존재하지 않는 아이디입니다." }; | ||
| 56 | + } catch (err) { | ||
| 57 | + return { success: false, msg: err }; | ||
| 58 | + } finally { | ||
| 59 | + connection.release(); | ||
| 60 | + } | ||
| 61 | + } catch (err) { | ||
| 62 | + logger.error(`login DB Connection error\n: ${JSON.stringify(err)}`); | ||
| 63 | + return false; | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | +>>>>>>> release_v0.2.0 | ||
| 39 | async register() { | 68 | async register() { |
| 40 | const client = this.body; | 69 | const client = this.body; |
| 41 | try { | 70 | try { | ... | ... |
| ... | @@ -13,6 +13,7 @@ class UserStorage { | ... | @@ -13,6 +13,7 @@ class UserStorage { |
| 13 | 13 | ||
| 14 | // static getUsers(isAll, ...fields) {} | 14 | // static getUsers(isAll, ...fields) {} |
| 15 | static async getUserInfo(connection, id) { | 15 | static async getUserInfo(connection, id) { |
| 16 | +<<<<<<< HEAD | ||
| 16 | return new Promise((resolve, reject) => { | 17 | return new Promise((resolve, reject) => { |
| 17 | const query = "SELECT * FROM users WHERE id = ?;"; | 18 | const query = "SELECT * FROM users WHERE id = ?;"; |
| 18 | connection.query(query, [id], (err, data) => { | 19 | connection.query(query, [id], (err, data) => { |
| ... | @@ -23,6 +24,20 @@ class UserStorage { | ... | @@ -23,6 +24,20 @@ class UserStorage { |
| 23 | }); | 24 | }); |
| 24 | }); | 25 | }); |
| 25 | } | 26 | } |
| 27 | +======= | ||
| 28 | + const query = `SELECT * FROM users WHERE id = '${id}';`; | ||
| 29 | + console.log(query); | ||
| 30 | + let [row] = await connection.query(query); | ||
| 31 | + console.log(row[0]); | ||
| 32 | + return row[0]; | ||
| 33 | + // , [id], (err, data) => { | ||
| 34 | + // console.log("44444444"); | ||
| 35 | + // if (err) reject(`${err}`); | ||
| 36 | + // resolve(data[0]); | ||
| 37 | + // pool.releaseConnection(conn); | ||
| 38 | + // }); | ||
| 39 | + } | ||
| 40 | +>>>>>>> release_v0.2.0 | ||
| 26 | 41 | ||
| 27 | static async save (connection, userInfo) { | 42 | static async save (connection, userInfo) { |
| 28 | const query = "INSERT INTO users(id, name, password) VALUES(?, ?, ?);"; | 43 | const query = "INSERT INTO users(id, name, password) VALUES(?, ?, ?);"; | ... | ... |
login_main/app/src/public/css/home/chat.css
0 → 100644
| 1 | +* { | ||
| 2 | + margin: 0; | ||
| 3 | + padding: 0; | ||
| 4 | +} | ||
| 5 | + | ||
| 6 | +html, body { | ||
| 7 | + height : 100%; | ||
| 8 | +} | ||
| 9 | + | ||
| 10 | +.wrapper { | ||
| 11 | + height : 100%; | ||
| 12 | + width: 100%; | ||
| 13 | + display: flex; | ||
| 14 | + flex-direction: column; | ||
| 15 | + overflow: hidden; | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +.user-container { | ||
| 19 | + background: rebeccapurple; | ||
| 20 | + flex: 1; | ||
| 21 | + display: flex; | ||
| 22 | + justify-content: flex-start; | ||
| 23 | + align-items: center; | ||
| 24 | + padding: 0.5rem; | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +.user-container .nickname { | ||
| 28 | + font-size : 14px; | ||
| 29 | + margin-right : 1.5rem; | ||
| 30 | + margin-left : 1rem; | ||
| 31 | + color:#fff; | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +.user-container input { | ||
| 35 | + border-radius: 3px; | ||
| 36 | + border: none; | ||
| 37 | + height: 80%; | ||
| 38 | +} | ||
| 39 | + | ||
| 40 | +.display-container { | ||
| 41 | + background: #D2D2FF; | ||
| 42 | + flex : 12; | ||
| 43 | + overflow-y:scroll; | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | +.input-container { | ||
| 47 | + flex:1; | ||
| 48 | + display:flex; | ||
| 49 | + justify-content: stretch; | ||
| 50 | + align-items: stretch; | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +.input-container span { | ||
| 54 | + display: flex; | ||
| 55 | + justify-content: flex-start; | ||
| 56 | + align-items:center; | ||
| 57 | + padding: 0.3rem; | ||
| 58 | + width: 100%; | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +.chatting-input { | ||
| 62 | + font-size:12px; | ||
| 63 | + height:100%; | ||
| 64 | + flex:8; | ||
| 65 | + border:none; | ||
| 66 | +} | ||
| 67 | + | ||
| 68 | +.send-button { | ||
| 69 | + flex:1; | ||
| 70 | + background: rebeccapurple; | ||
| 71 | + color:#fff; | ||
| 72 | + border:none; | ||
| 73 | + height:100%; | ||
| 74 | + border-radius:3px; | ||
| 75 | +} | ||
| 76 | + | ||
| 77 | +.chatting-list li { | ||
| 78 | + width:50%; | ||
| 79 | + padding:0.3rem; | ||
| 80 | + display:flex; | ||
| 81 | + justify-content: flex-start; | ||
| 82 | + align-items:flex-end; | ||
| 83 | + margin-top:0.5rem; | ||
| 84 | +} | ||
| 85 | + | ||
| 86 | +.profile { | ||
| 87 | + display: flex; | ||
| 88 | + flex-direction: column; | ||
| 89 | + align-items: center; | ||
| 90 | + justify-content: center; | ||
| 91 | + flex: 1; | ||
| 92 | +} | ||
| 93 | + | ||
| 94 | +.profile .user { | ||
| 95 | + font-size: 10px; | ||
| 96 | + margin-bottom: 0.3rem; | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +.profile .image { | ||
| 100 | + border-radius: 50%; | ||
| 101 | + object-fit: cover; | ||
| 102 | + width: 50px; | ||
| 103 | + height: 50px; | ||
| 104 | +} | ||
| 105 | + | ||
| 106 | +.message { | ||
| 107 | + border-radius: 5px; | ||
| 108 | + padding: 0.5rem; | ||
| 109 | + font-size: 12px; | ||
| 110 | + margin: 0 5px; | ||
| 111 | + flex: 10; | ||
| 112 | +} | ||
| 113 | + | ||
| 114 | +.time { | ||
| 115 | + font-size: 10px; | ||
| 116 | + margin: 0 5px; | ||
| 117 | +} | ||
| 118 | + | ||
| 119 | +.sent { | ||
| 120 | + flex-direction: row-reverse; | ||
| 121 | + float: right; | ||
| 122 | +} | ||
| 123 | + | ||
| 124 | +.sent .message { | ||
| 125 | + background: #9986EE; | ||
| 126 | + color: #fff; | ||
| 127 | +} | ||
| 128 | + | ||
| 129 | +.received .message { | ||
| 130 | + background: #fff; | ||
| 131 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -40,7 +40,11 @@ | ... | @@ -40,7 +40,11 @@ |
| 40 | cursor: pointer; | 40 | cursor: pointer; |
| 41 | font-family: inherit; | 41 | font-family: inherit; |
| 42 | color :lightslategray; | 42 | color :lightslategray; |
| 43 | +<<<<<<< HEAD | ||
| 43 | margin-right: 30px; | 44 | margin-right: 30px; |
| 45 | +======= | ||
| 46 | + margin-right: 0px; | ||
| 47 | +>>>>>>> release_v0.2.0 | ||
| 44 | } | 48 | } |
| 45 | 49 | ||
| 46 | .category-title { | 50 | .category-title { | ... | ... |
| ... | @@ -7,6 +7,7 @@ | ... | @@ -7,6 +7,7 @@ |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | .infowindow-title { | 9 | .infowindow-title { |
| 10 | +<<<<<<< HEAD | ||
| 10 | font-size: 3rem; | 11 | font-size: 3rem; |
| 11 | } | 12 | } |
| 12 | 13 | ||
| ... | @@ -16,4 +17,17 @@ | ... | @@ -16,4 +17,17 @@ |
| 16 | 17 | ||
| 17 | .infowindow-btn { | 18 | .infowindow-btn { |
| 18 | font-size: 1.6rem; | 19 | font-size: 1.6rem; |
| 20 | +======= | ||
| 21 | + font-size: 15px; | ||
| 22 | + color: rebeccapurple; | ||
| 23 | + font-weight: 600; | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +.infowindow-address { | ||
| 27 | + font-size: 8px; | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +.infowindow-btn { | ||
| 31 | + font-size: 8px; | ||
| 32 | +>>>>>>> release_v0.2.0 | ||
| 19 | } | 33 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -4,8 +4,13 @@ | ... | @@ -4,8 +4,13 @@ |
| 4 | 4 | ||
| 5 | var container = document.getElementById('map'); //지도를 담을 영역의 DOM 레퍼런스 | 5 | var container = document.getElementById('map'); //지도를 담을 영역의 DOM 레퍼런스 |
| 6 | var options = { //지도를 생성할 때 필요한 기본 옵션 | 6 | var options = { //지도를 생성할 때 필요한 기본 옵션 |
| 7 | +<<<<<<< HEAD | ||
| 7 | center: new kakao.maps.LatLng(37.54, 126.96), //지도의 중심좌표. | 8 | center: new kakao.maps.LatLng(37.54, 126.96), //지도의 중심좌표. |
| 8 | level: 7 //지도의 레벨(확대, 축소 정도) | 9 | level: 7 //지도의 레벨(확대, 축소 정도) |
| 10 | +======= | ||
| 11 | + center: new kakao.maps.LatLng(37.248, 127.08), //지도의 중심좌표. | ||
| 12 | + level: 4 //지도의 레벨(확대, 축소 정도) | ||
| 13 | +>>>>>>> release_v0.2.0 | ||
| 9 | }; | 14 | }; |
| 10 | 15 | ||
| 11 | var map = new kakao.maps.Map(container, options); //지도 생성 및 객체 리턴 | 16 | var map = new kakao.maps.Map(container, options); //지도 생성 및 객체 리턴 |
| ... | @@ -18,6 +23,7 @@ | ... | @@ -18,6 +23,7 @@ |
| 18 | * 2. 데이터 준비하기(제목, 주소, 카테고리) | 23 | * 2. 데이터 준비하기(제목, 주소, 카테고리) |
| 19 | */ | 24 | */ |
| 20 | 25 | ||
| 26 | +<<<<<<< HEAD | ||
| 21 | const dataSet = [ | 27 | const dataSet = [ |
| 22 | { | 28 | { |
| 23 | title: "희락돈까스", | 29 | title: "희락돈까스", |
| ... | @@ -53,6 +59,46 @@ const dataSet = [ | ... | @@ -53,6 +59,46 @@ const dataSet = [ |
| 53 | // } | 59 | // } |
| 54 | 60 | ||
| 55 | // getDataSet(); | 61 | // getDataSet(); |
| 62 | +======= | ||
| 63 | +// const dataSet = [ | ||
| 64 | +// { | ||
| 65 | +// title: "희락돈까스", | ||
| 66 | +// address: "서울 영등포구 양산로 210", | ||
| 67 | +// category: "양식", | ||
| 68 | +// }, | ||
| 69 | +// { | ||
| 70 | +// title: "즉석우동짜장", | ||
| 71 | +// address: "서울 영등포구 대방천로 260", | ||
| 72 | +// category: "한식", | ||
| 73 | +// }, | ||
| 74 | +// { | ||
| 75 | +// title: "아카사카", | ||
| 76 | +// address: "서울 서초구 서초대로74길 23", | ||
| 77 | +// category: "일식", | ||
| 78 | +// } | ||
| 79 | +// ]; | ||
| 80 | + | ||
| 81 | + async function getDataSet(category) { | ||
| 82 | + let qs = category; | ||
| 83 | + if(!qs) { | ||
| 84 | + qs = ""; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + const dataSet = await axios({ | ||
| 88 | + method: "get", // http method | ||
| 89 | + url: `http://localhost:3000/restaurants?category=${qs}`, | ||
| 90 | + headers: {}, | ||
| 91 | + data: {}, | ||
| 92 | + }); | ||
| 93 | + // console.log(dataSet); | ||
| 94 | + | ||
| 95 | + return dataSet.data.result; | ||
| 96 | +} | ||
| 97 | + | ||
| 98 | +// } | ||
| 99 | + | ||
| 100 | + getDataSet(); | ||
| 101 | +>>>>>>> release_v0.2.0 | ||
| 56 | 102 | ||
| 57 | /****************************************************************************** | 103 | /****************************************************************************** |
| 58 | * 3. 여러개 마커찍기 | 104 | * 3. 여러개 마커찍기 |
| ... | @@ -75,7 +121,11 @@ const dataSet = [ | ... | @@ -75,7 +121,11 @@ const dataSet = [ |
| 75 | }); | 121 | }); |
| 76 | } | 122 | } |
| 77 | 123 | ||
| 124 | +<<<<<<< HEAD | ||
| 78 | setMap(dataSet); | 125 | setMap(dataSet); |
| 126 | +======= | ||
| 127 | +// setMap(dataSet); | ||
| 128 | +>>>>>>> release_v0.2.0 | ||
| 79 | 129 | ||
| 80 | /* | 130 | /* |
| 81 | ************************************************************* | 131 | ************************************************************* |
| ... | @@ -170,6 +220,10 @@ const dataSet = [ | ... | @@ -170,6 +220,10 @@ const dataSet = [ |
| 170 | const categoryId = event.target.id; | 220 | const categoryId = event.target.id; |
| 171 | const category = categoryMap[categoryId]; | 221 | const category = categoryMap[categoryId]; |
| 172 | 222 | ||
| 223 | +<<<<<<< HEAD | ||
| 224 | +======= | ||
| 225 | + | ||
| 226 | +>>>>>>> release_v0.2.0 | ||
| 173 | try { | 227 | try { |
| 174 | // 데이터 분류 | 228 | // 데이터 분류 |
| 175 | let categorizedDataSet = await getDataSet(category); | 229 | let categorizedDataSet = await getDataSet(category); |
| ... | @@ -194,6 +248,7 @@ const dataSet = [ | ... | @@ -194,6 +248,7 @@ const dataSet = [ |
| 194 | } | 248 | } |
| 195 | } | 249 | } |
| 196 | 250 | ||
| 251 | +<<<<<<< HEAD | ||
| 197 | setMap(dataSet); | 252 | setMap(dataSet); |
| 198 | 253 | ||
| 199 | // async function setting() { | 254 | // async function setting() { |
| ... | @@ -206,4 +261,16 @@ const dataSet = [ | ... | @@ -206,4 +261,16 @@ const dataSet = [ |
| 206 | // } | 261 | // } |
| 207 | // } | 262 | // } |
| 208 | 263 | ||
| 209 | -// setting(); | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 264 | +// setting(); | ||
| 265 | +======= | ||
| 266 | + async function setting() { | ||
| 267 | + try { | ||
| 268 | + const dataSet = await getDataSet(); | ||
| 269 | + setMap(dataSet); | ||
| 270 | + } catch (error) { | ||
| 271 | + console.error(error); | ||
| 272 | + } | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + setting(); | ||
| 276 | +>>>>>>> release_v0.2.0 | ... | ... |
login_main/app/src/public/js/home/chat.js
0 → 100644
| 1 | +"use strict"; | ||
| 2 | + | ||
| 3 | +const socketIO = require("socket.io"); | ||
| 4 | +const http = require("http"); | ||
| 5 | +const app = express(); | ||
| 6 | +const server = http.createServer(app); | ||
| 7 | +const io = socketIO(server); | ||
| 8 | +const socket = io(); | ||
| 9 | +//.connect("http://localhost:3000/chat", {transports:['websocket']}); | ||
| 10 | + | ||
| 11 | +const nickname = document.querySelector("#nickname") | ||
| 12 | +const chatlist = document.querySelector(".chatting-list") | ||
| 13 | +const chatInput = document.querySelector(".chatting-input") | ||
| 14 | +const sendButton = document.querySelector(".send-button") | ||
| 15 | +const displayContainer = document.querySelector(".display-container") | ||
| 16 | + | ||
| 17 | +chatInput.addEventListener("keypress", (event)=> { | ||
| 18 | + if(event.keyCode === 13) { | ||
| 19 | + send() | ||
| 20 | + } | ||
| 21 | +}) | ||
| 22 | + | ||
| 23 | +function send() { | ||
| 24 | + const param = { | ||
| 25 | + name: nickname.value, | ||
| 26 | + msg: chatInput.value | ||
| 27 | + } | ||
| 28 | + socket.emit("chatting", param) | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +sendButton.addEventListener("click", send) | ||
| 32 | + | ||
| 33 | +socket.on("chatting", (data)=>{ | ||
| 34 | + console.log(data) | ||
| 35 | + const {name, msg, time} = data; | ||
| 36 | + const item = new LiModel(name, msg, time); | ||
| 37 | + item.makeLi() | ||
| 38 | + displayContainer.scrollTo(0, displayContainer.scrollHeight) | ||
| 39 | +}) | ||
| 40 | + | ||
| 41 | +//console.log(socket); | ||
| 42 | + | ||
| 43 | +function LiModel(name, msg, time) { | ||
| 44 | + this.name = name; | ||
| 45 | + this.msg = msg; | ||
| 46 | + this.time = time; | ||
| 47 | + | ||
| 48 | + this.makeLi = ()=>{ | ||
| 49 | + const li = document.createElement("li"); | ||
| 50 | + li.classList.add(nickname.value === this.name ? "sent":"received") | ||
| 51 | + const dom = `<span class="profile"> | ||
| 52 | + <span class="user">${this.name}</span> | ||
| 53 | + <img class="image" src="https://placeimg.com/50/50/any" alt="any"> | ||
| 54 | + </span> | ||
| 55 | + <span class="message">${this.msg}</span> | ||
| 56 | + <span class="time">${this.time}</span>`; | ||
| 57 | + | ||
| 58 | + li.innerHTML = dom; | ||
| 59 | + chatlist.appendChild(li) | ||
| 60 | + } | ||
| 61 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -12,6 +12,10 @@ function login() { | ... | @@ -12,6 +12,10 @@ function login() { |
| 12 | password : password.value, | 12 | password : password.value, |
| 13 | }; | 13 | }; |
| 14 | 14 | ||
| 15 | +<<<<<<< HEAD | ||
| 16 | +======= | ||
| 17 | + // console.log("login value : ", id.value); | ||
| 18 | +>>>>>>> release_v0.2.0 | ||
| 15 | fetch("/login", { | 19 | fetch("/login", { |
| 16 | method: "POST", | 20 | method: "POST", |
| 17 | headers: { | 21 | headers: { | ... | ... |
| ... | @@ -12,7 +12,10 @@ async function register() { | ... | @@ -12,7 +12,10 @@ async function register() { |
| 12 | if(!id.value) { | 12 | if(!id.value) { |
| 13 | return alert("아이디를 입력해주세요.") | 13 | return alert("아이디를 입력해주세요.") |
| 14 | } | 14 | } |
| 15 | +<<<<<<< HEAD | ||
| 15 | 16 | ||
| 17 | +======= | ||
| 18 | +>>>>>>> release_v0.2.0 | ||
| 16 | if(!name.value) { | 19 | if(!name.value) { |
| 17 | return alert("이름을 입력해주세요.") | 20 | return alert("이름을 입력해주세요.") |
| 18 | } | 21 | } |
| ... | @@ -25,13 +28,18 @@ async function register() { | ... | @@ -25,13 +28,18 @@ async function register() { |
| 25 | if (password.value !== confirmPassword.value) { | 28 | if (password.value !== confirmPassword.value) { |
| 26 | return alert("비밀번호가 일치하지 않습니다.") | 29 | return alert("비밀번호가 일치하지 않습니다.") |
| 27 | } | 30 | } |
| 31 | +<<<<<<< HEAD | ||
| 28 | 32 | ||
| 33 | +======= | ||
| 34 | + | ||
| 35 | +>>>>>>> release_v0.2.0 | ||
| 29 | const req = { | 36 | const req = { |
| 30 | id: id.value, | 37 | id: id.value, |
| 31 | name: name.value, | 38 | name: name.value, |
| 32 | password: password.value, | 39 | password: password.value, |
| 33 | }; | 40 | }; |
| 34 | 41 | ||
| 42 | +<<<<<<< HEAD | ||
| 35 | console.log("id : ", req.id); | 43 | console.log("id : ", req.id); |
| 36 | try { | 44 | try { |
| 37 | const response = await fetch("/register", { | 45 | const response = await fetch("/register", { |
| ... | @@ -45,5 +53,39 @@ async function register() { | ... | @@ -45,5 +53,39 @@ async function register() { |
| 45 | } catch(e) { | 53 | } catch(e) { |
| 46 | console.log(e); | 54 | console.log(e); |
| 47 | } | 55 | } |
| 56 | +======= | ||
| 57 | + fetch("/register", { | ||
| 58 | + method: "POST", | ||
| 59 | + headers: { | ||
| 60 | + "Content-Type": "application/json", | ||
| 61 | + }, | ||
| 62 | + body: JSON.stringify(req), | ||
| 63 | + }) | ||
| 64 | + .then((res) => res.json()) | ||
| 65 | + .then((res) => { | ||
| 66 | + if (res.success) { | ||
| 67 | + location.href = "/login"; | ||
| 68 | + } else { | ||
| 69 | + if (res.err) return alert(res.err); | ||
| 70 | + alert(res.msg); | ||
| 71 | + } | ||
| 72 | + }) | ||
| 73 | + .catch((err) => { | ||
| 74 | + console.error("회원가입 중 에러 발생"); | ||
| 75 | + }); | ||
| 76 | + | ||
| 77 | + // try { | ||
| 78 | + // const response = await fetch("/register", { | ||
| 79 | + // method: "POST", | ||
| 80 | + // headers: { | ||
| 81 | + // "Content-Type": "application/json" | ||
| 82 | + // }, | ||
| 83 | + // body: JSON.stringify(req), | ||
| 84 | + // }); | ||
| 85 | + // console.log("테스트 : ", response); | ||
| 86 | + // } catch(e) { | ||
| 87 | + // console.log(e); | ||
| 88 | + // } | ||
| 89 | +>>>>>>> release_v0.2.0 | ||
| 48 | 90 | ||
| 49 | } | 91 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -16,6 +16,13 @@ const output = { | ... | @@ -16,6 +16,13 @@ const output = { |
| 16 | res.render("home/register"); | 16 | res.render("home/register"); |
| 17 | }, | 17 | }, |
| 18 | 18 | ||
| 19 | +<<<<<<< HEAD | ||
| 20 | +======= | ||
| 21 | + chat: (req, res) => { | ||
| 22 | + res.render("home/chat"); | ||
| 23 | + }, | ||
| 24 | + | ||
| 25 | +>>>>>>> release_v0.2.0 | ||
| 19 | // restaurants: (req, res) => { | 26 | // restaurants: (req, res) => { |
| 20 | // res.render("home/restaurants"); | 27 | // res.render("home/restaurants"); |
| 21 | // } | 28 | // } |
| ... | @@ -31,6 +38,10 @@ const process = { | ... | @@ -31,6 +38,10 @@ const process = { |
| 31 | register: async (req, res) => { | 38 | register: async (req, res) => { |
| 32 | const user = new User(req.body); | 39 | const user = new User(req.body); |
| 33 | const response = await user.register(); | 40 | const response = await user.register(); |
| 41 | +<<<<<<< HEAD | ||
| 42 | +======= | ||
| 43 | + // console.log("req.body", req.body); | ||
| 44 | +>>>>>>> release_v0.2.0 | ||
| 34 | // console.log(res.json(response)); | 45 | // console.log(res.json(response)); |
| 35 | // console.log(res.json(response).statusCode); => 이거도 잘 찍혔음. | 46 | // console.log(res.json(response).statusCode); => 이거도 잘 찍혔음. |
| 36 | return res.json(response); | 47 | return res.json(response); | ... | ... |
| ... | @@ -6,10 +6,19 @@ const jwtMiddleware = require("../../config/jwtMiddleware"); | ... | @@ -6,10 +6,19 @@ const jwtMiddleware = require("../../config/jwtMiddleware"); |
| 6 | // const Restaurant = require("../../models/Restaurant"); | 6 | // const Restaurant = require("../../models/Restaurant"); |
| 7 | 7 | ||
| 8 | const ctrl = require("./home.ctrl"); | 8 | const ctrl = require("./home.ctrl"); |
| 9 | +<<<<<<< HEAD | ||
| 10 | +======= | ||
| 11 | +const index = require("../../models/Restaurant"); | ||
| 12 | +>>>>>>> release_v0.2.0 | ||
| 9 | 13 | ||
| 10 | router.get("/", ctrl.output.hello); | 14 | router.get("/", ctrl.output.hello); |
| 11 | router.get("/login", ctrl.output.login); | 15 | router.get("/login", ctrl.output.login); |
| 12 | router.get("/register", ctrl.output.register); | 16 | router.get("/register", ctrl.output.register); |
| 17 | +<<<<<<< HEAD | ||
| 18 | +======= | ||
| 19 | +router.get("/restaurants", index.readRestaurants); | ||
| 20 | +router.get("/chat", ctrl.output.chat); | ||
| 21 | +>>>>>>> release_v0.2.0 | ||
| 13 | // router.get("/restaurants", Restaurant.restaurants); | 22 | // router.get("/restaurants", Restaurant.restaurants); |
| 14 | // router.get("/restaurants", ctrl.output.restaurants); | 23 | // router.get("/restaurants", ctrl.output.restaurants); |
| 15 | 24 | ... | ... |
| ... | @@ -4,7 +4,37 @@ | ... | @@ -4,7 +4,37 @@ |
| 4 | <meta charset="UTF-8" /> | 4 | <meta charset="UTF-8" /> |
| 5 | <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | 5 | <meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
| 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| 7 | +<<<<<<< HEAD | ||
| 7 | <title>채팅</title> | 8 | <title>채팅</title> |
| 8 | </head> | 9 | </head> |
| 9 | <body></body> | 10 | <body></body> |
| 11 | +======= | ||
| 12 | + <title>채팅방</title> | ||
| 13 | + <link rel="stylesheet" href="/css/home/chat.css" /> | ||
| 14 | + </head> | ||
| 15 | + <body> | ||
| 16 | + <div class="wrapper"> | ||
| 17 | + <div class="user-container"> | ||
| 18 | + <lable class="nickname" for="nickname">닉네임설정</lable> | ||
| 19 | + <input type="text" id="nickname" /> | ||
| 20 | + </div> | ||
| 21 | + <div class="display-container"> | ||
| 22 | + <ul class="chatting-list"></ul> | ||
| 23 | + </div> | ||
| 24 | + <div class="input-container"> | ||
| 25 | + <span> | ||
| 26 | + <input type="text" class="chatting-input" /> | ||
| 27 | + <button class="send-button">전송</button> | ||
| 28 | + </span> | ||
| 29 | + </div> | ||
| 30 | + </div> | ||
| 31 | + <script | ||
| 32 | + src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.5.1/socket.io.js" | ||
| 33 | + integrity="sha512-9mpsATI0KClwt+xVZfbcf2lJ8IFBAwsubJ6mI3rtULwyM3fBmQFzj0It4tGqxLOGQwGfJdk/G+fANnxfq9/cew==" | ||
| 34 | + crossorigin="anonymous" | ||
| 35 | + referrerpolicy="no-referrer" | ||
| 36 | + ></script> | ||
| 37 | + <script src="/js/home/chat.js"></script> | ||
| 38 | + </body> | ||
| 39 | +>>>>>>> release_v0.2.0 | ||
| 10 | </html> | 40 | </html> | ... | ... |
| ... | @@ -9,14 +9,22 @@ | ... | @@ -9,14 +9,22 @@ |
| 9 | <meta name="description" content="맛집지도 서비스" /> | 9 | <meta name="description" content="맛집지도 서비스" /> |
| 10 | <meta name="keywords" content="맛집지도, 맛집추천, 실시간채팅" /> | 10 | <meta name="keywords" content="맛집지도, 맛집추천, 실시간채팅" /> |
| 11 | <link rel="stylesheet" href="/css/home/index.css" /> | 11 | <link rel="stylesheet" href="/css/home/index.css" /> |
| 12 | +<<<<<<< HEAD | ||
| 12 | <script src="/js/home/axios-index.js"></script> | 13 | <script src="/js/home/axios-index.js"></script> |
| 14 | +======= | ||
| 15 | + <link rel="stylesheet" href="/css/home/map.css" /> | ||
| 16 | +>>>>>>> release_v0.2.0 | ||
| 13 | </head> | 17 | </head> |
| 14 | <body> | 18 | <body> |
| 15 | <nav> | 19 | <nav> |
| 16 | <div class="inner"> | 20 | <div class="inner"> |
| 17 | <div class="nav-container"> | 21 | <div class="nav-container"> |
| 18 | <h1 class="nav-title">맛집지도</h1> | 22 | <h1 class="nav-title">맛집지도</h1> |
| 23 | +<<<<<<< HEAD | ||
| 19 | <button class="nav-contact">Chatting Rooms</button> | 24 | <button class="nav-contact">Chatting Rooms</button> |
| 25 | +======= | ||
| 26 | + <button class="nav-contact">Contact : balljm@naver.com</button> | ||
| 27 | +>>>>>>> release_v0.2.0 | ||
| 20 | </div> | 28 | </div> |
| 21 | </div> | 29 | </div> |
| 22 | </nav> | 30 | </nav> |
| ... | @@ -49,11 +57,20 @@ | ... | @@ -49,11 +57,20 @@ |
| 49 | type="text/javascript" | 57 | type="text/javascript" |
| 50 | src="//dapi.kakao.com/v2/maps/sdk.js?appkey=e55f753363b95e27b799aa6286a6c398&libraries=services" | 58 | src="//dapi.kakao.com/v2/maps/sdk.js?appkey=e55f753363b95e27b799aa6286a6c398&libraries=services" |
| 51 | ></script> | 59 | ></script> |
| 60 | +<<<<<<< HEAD | ||
| 52 | <!-- <script | 61 | <!-- <script |
| 62 | +======= | ||
| 63 | + <script | ||
| 64 | +>>>>>>> release_v0.2.0 | ||
| 53 | src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.0.0-alpha.1/axios.min.js" | 65 | src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.0.0-alpha.1/axios.min.js" |
| 54 | integrity="sha512-xIPqqrfvUAc/Cspuj7Bq0UtHNo/5qkdyngx6Vwt+tmbvTLDszzXM0G6c91LXmGrRx8KEPulT+AfOOez+TeVylg==" | 66 | integrity="sha512-xIPqqrfvUAc/Cspuj7Bq0UtHNo/5qkdyngx6Vwt+tmbvTLDszzXM0G6c91LXmGrRx8KEPulT+AfOOez+TeVylg==" |
| 55 | crossorigin="anonymous" | 67 | crossorigin="anonymous" |
| 56 | referrerpolicy="no-referrer" | 68 | referrerpolicy="no-referrer" |
| 69 | +<<<<<<< HEAD | ||
| 57 | ></script> --> | 70 | ></script> --> |
| 71 | +======= | ||
| 72 | + ></script> | ||
| 73 | + <script src="/js/home/axios-index.js"></script> | ||
| 74 | +>>>>>>> release_v0.2.0 | ||
| 58 | </body> | 75 | </body> |
| 59 | </html> | 76 | </html> | ... | ... |
-
Please register or login to post a comment