Jeongmin Seo

merge release_v0.2.0 branch

MIT License
Copyright (c) 2022 Jeongmin Seo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
\ No newline at end of file
......@@ -115,4 +115,10 @@ dist
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
\ No newline at end of file
<<<<<<< HEAD
.pnp.*
=======
.pnp.*
.package-lock.json
>>>>>>> release_v0.2.0
......
......@@ -5,6 +5,7 @@ const bodyParser = require("body-parser");
//환경변수 (운영체제간 gap 없애고자)
const dotenv = require("dotenv");
dotenv.config();
<<<<<<< HEAD
const compression = require("compression");
const methodOverride = require("method-override");
......@@ -18,23 +19,68 @@ const home = require("./src/routes/home");
const port = 3000;
const jwtMiddleware = require("./src/config/jwtMiddleware");
=======
const compression = require("compression");
const methodOverride = require("method-override");
const path = require("path")
const socketIO = require("socket.io")
const moment = require("moment")
const http = require("http");
const app = express();
const server = http.createServer(app);
var cors = require("cors");
const { logger } = require("./src/config/winston");
//app이라는 express 객체 생성
//라우팅
const home = require("./src/routes/home");
const port = 3000;
const jwtMiddleware = require("./src/config/jwtMiddleware");
const io = socketIO(server);
>>>>>>> release_v0.2.0
// 앱 세팅
app.set("views", "./src/views");
app.set("view engine", "ejs");
app.use(express.static(`${__dirname}/src/public`));
<<<<<<< HEAD
app.use(bodyParser.json());
//url통해 전달되는 데이터에 한글, 공백 등의 문자 오류 해결
app.use(bodyParser.urlencoded({extended: true}));
=======
app.use(express.static(path.join(__dirname, "src")))
app.use(bodyParser.json());
//url통해 전달되는 데이터에 한글, 공백 등의 문자 오류 해결
app.use(bodyParser.urlencoded({extended: true}));
>>>>>>> release_v0.2.0
app.use(compression()); // HTTP 요청을 압축 및 해제
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(methodOverride());
app.use(cors());
// app.use("/restaurants", require("../app/src/routes/home/restaurant.route"));
<<<<<<< HEAD
require("../app/src/routes/home/restaurant.route")(app);
app.use("/", home); //미들웨어 등록해주는 method
=======
// require("../app/src/routes/home/restaurant.route")(app);
app.use("/", home); //미들웨어 등록해주는 method
io.on('connection', (socket) => {
socket.on("chatting", (data)=>{
const { name, msg } = data;
io.emit("chatting", {
name,
msg,
time : moment(new Date()).format("h:ss A")})
})
});
>>>>>>> release_v0.2.0
logger.info(`${process.env.NODE_ENV} - API Server Start At Port ${port}`);
module.exports = app;
\ No newline at end of file
......
......@@ -19,6 +19,24 @@
"kuler": "^2.0.0"
}
},
<<<<<<< HEAD
=======
"@types/component-emitter": {
"version": "1.2.11",
"resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz",
"integrity": "sha512-SRXjM+tfsSlA9VuG8hGO2nft2p8zjXCK1VcC6N4NXbBbYbSia9kzCChYQajIjzIqOOOuh5Ock6MmV2oux4jDZQ=="
},
"@types/cookie": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
"integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q=="
},
"@types/cors": {
"version": "2.8.12",
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.12.tgz",
"integrity": "sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw=="
},
>>>>>>> release_v0.2.0
"@types/mysql": {
"version": "2.15.21",
"resolved": "https://registry.npmjs.org/@types/mysql/-/mysql-2.15.21.tgz",
......@@ -103,6 +121,14 @@
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
<<<<<<< HEAD
=======
"base64id": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz",
"integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog=="
},
>>>>>>> release_v0.2.0
"bcrypt-pbkdf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
......@@ -239,6 +265,14 @@
"delayed-stream": "~1.0.0"
}
},
<<<<<<< HEAD
=======
"component-emitter": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
"integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg=="
},
>>>>>>> release_v0.2.0
"compressible": {
"version": "2.0.18",
"resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz",
......@@ -406,6 +440,51 @@
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w=="
},
<<<<<<< HEAD
=======
"engine.io": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.2.0.tgz",
"integrity": "sha512-4KzwW3F3bk+KlzSOY57fj/Jx6LyRQ1nbcyIadehl+AnXjKT7gDO0ORdRi/84ixvMKTym6ZKuxvbzN62HDDU1Lg==",
"requires": {
"@types/cookie": "^0.4.1",
"@types/cors": "^2.8.12",
"@types/node": ">=10.0.0",
"accepts": "~1.3.4",
"base64id": "2.0.0",
"cookie": "~0.4.1",
"cors": "~2.8.5",
"debug": "~4.3.1",
"engine.io-parser": "~5.0.3",
"ws": "~8.2.3"
},
"dependencies": {
"cookie": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz",
"integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA=="
},
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"requires": {
"ms": "2.1.2"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
}
}
},
"engine.io-parser": {
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.4.tgz",
"integrity": "sha512-+nVFp+5z1E3HcToEnO7ZIj3g+3k9389DvWtvJZz0T6/eOCPIyyxehFcedoYrZQrp0LgQbD9pPXhpMBKMd5QURg=="
},
>>>>>>> release_v0.2.0
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
......@@ -1255,6 +1334,67 @@
"is-arrayish": "^0.3.1"
}
},
<<<<<<< HEAD
=======
"socket.io": {
"version": "4.5.1",
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.5.1.tgz",
"integrity": "sha512-0y9pnIso5a9i+lJmsCdtmTTgJFFSvNQKDnPQRz28mGNnxbmqYg2QPtJTLFxhymFZhAIn50eHAKzJeiNaKr+yUQ==",
"requires": {
"accepts": "~1.3.4",
"base64id": "~2.0.0",
"debug": "~4.3.2",
"engine.io": "~6.2.0",
"socket.io-adapter": "~2.4.0",
"socket.io-parser": "~4.0.4"
},
"dependencies": {
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"requires": {
"ms": "2.1.2"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
}
}
},
"socket.io-adapter": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.4.0.tgz",
"integrity": "sha512-W4N+o69rkMEGVuk2D/cvca3uYsvGlMwsySWV447y99gUPghxq42BxqLNMndb+a1mm/5/7NeXVQS7RLa2XyXvYg=="
},
"socket.io-parser": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.0.4.tgz",
"integrity": "sha512-t+b0SS+IxG7Rxzda2EVvyBZbvFPBCjJoyHuE0P//7OAsN23GItzDRdWa6ALxZI/8R5ygK7jAR6t028/z+7295g==",
"requires": {
"@types/component-emitter": "^1.2.10",
"component-emitter": "~1.3.0",
"debug": "~4.3.1"
},
"dependencies": {
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"requires": {
"ms": "2.1.2"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
}
}
},
>>>>>>> release_v0.2.0
"sqlstring": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz",
......@@ -1467,6 +1607,14 @@
}
}
},
<<<<<<< HEAD
=======
"ws": {
"version": "8.2.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz",
"integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA=="
},
>>>>>>> release_v0.2.0
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
......
......@@ -16,10 +16,18 @@
"express": "^4.18.1",
"jsonwebtoken": "^8.5.1",
"method-override": "^3.0.0",
<<<<<<< HEAD
=======
"moment": "^2.29.3",
>>>>>>> release_v0.2.0
"mysql": "^2.18.1",
"mysql2": "^2.2.0",
"regex-email": "^1.0.2",
"request": "^2.88.2",
<<<<<<< HEAD
=======
"socket.io": "^4.5.1",
>>>>>>> release_v0.2.0
"winston": "^3.2.1",
"winston-daily-rotate-file": "^4.2.1"
},
......@@ -31,7 +39,11 @@
"prod": "NODE_ENV=production node index.js"
},
"author": "Jeongmin Seo, Jumi Yang",
<<<<<<< HEAD
"license": "ISC",
=======
"license": "MIT",
>>>>>>> release_v0.2.0
"keywords": [],
"description": "Node.js API Server"
}
......
......@@ -12,6 +12,7 @@ class User {
async login() {
const client = this.body;
<<<<<<< HEAD
try {
try {
......@@ -36,6 +37,34 @@ class User {
}
}
=======
try {
const connection = await pool.getConnection(async (conn) => conn);
try {
const { id, password } = await UserStorage.getUserInfo(
connection,
client.id
);
if (id) {
if (id === client.id && password === client.password) {
return { success: true };
}
return { success: false, msg: "비밀번호가 틀렸습니다." };
}
return { success: false, msg: "존재하지 않는 아이디입니다." };
} catch (err) {
return { success: false, msg: err };
} finally {
connection.release();
}
} catch (err) {
logger.error(`login DB Connection error\n: ${JSON.stringify(err)}`);
return false;
}
}
>>>>>>> release_v0.2.0
async register() {
const client = this.body;
try {
......
......@@ -13,6 +13,7 @@ class UserStorage {
// static getUsers(isAll, ...fields) {}
static async getUserInfo(connection, id) {
<<<<<<< HEAD
return new Promise((resolve, reject) => {
const query = "SELECT * FROM users WHERE id = ?;";
connection.query(query, [id], (err, data) => {
......@@ -23,6 +24,20 @@ class UserStorage {
});
});
}
=======
const query = `SELECT * FROM users WHERE id = '${id}';`;
console.log(query);
let [row] = await connection.query(query);
console.log(row[0]);
return row[0];
// , [id], (err, data) => {
// console.log("44444444");
// if (err) reject(`${err}`);
// resolve(data[0]);
// pool.releaseConnection(conn);
// });
}
>>>>>>> release_v0.2.0
static async save (connection, userInfo) {
const query = "INSERT INTO users(id, name, password) VALUES(?, ?, ?);";
......
* {
margin: 0;
padding: 0;
}
html, body {
height : 100%;
}
.wrapper {
height : 100%;
width: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
}
.user-container {
background: rebeccapurple;
flex: 1;
display: flex;
justify-content: flex-start;
align-items: center;
padding: 0.5rem;
}
.user-container .nickname {
font-size : 14px;
margin-right : 1.5rem;
margin-left : 1rem;
color:#fff;
}
.user-container input {
border-radius: 3px;
border: none;
height: 80%;
}
.display-container {
background: #D2D2FF;
flex : 12;
overflow-y:scroll;
}
.input-container {
flex:1;
display:flex;
justify-content: stretch;
align-items: stretch;
}
.input-container span {
display: flex;
justify-content: flex-start;
align-items:center;
padding: 0.3rem;
width: 100%;
}
.chatting-input {
font-size:12px;
height:100%;
flex:8;
border:none;
}
.send-button {
flex:1;
background: rebeccapurple;
color:#fff;
border:none;
height:100%;
border-radius:3px;
}
.chatting-list li {
width:50%;
padding:0.3rem;
display:flex;
justify-content: flex-start;
align-items:flex-end;
margin-top:0.5rem;
}
.profile {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex: 1;
}
.profile .user {
font-size: 10px;
margin-bottom: 0.3rem;
}
.profile .image {
border-radius: 50%;
object-fit: cover;
width: 50px;
height: 50px;
}
.message {
border-radius: 5px;
padding: 0.5rem;
font-size: 12px;
margin: 0 5px;
flex: 10;
}
.time {
font-size: 10px;
margin: 0 5px;
}
.sent {
flex-direction: row-reverse;
float: right;
}
.sent .message {
background: #9986EE;
color: #fff;
}
.received .message {
background: #fff;
}
\ No newline at end of file
......@@ -40,7 +40,11 @@
cursor: pointer;
font-family: inherit;
color :lightslategray;
<<<<<<< HEAD
margin-right: 30px;
=======
margin-right: 0px;
>>>>>>> release_v0.2.0
}
.category-title {
......
......@@ -7,6 +7,7 @@
}
.infowindow-title {
<<<<<<< HEAD
font-size: 3rem;
}
......@@ -16,4 +17,17 @@
.infowindow-btn {
font-size: 1.6rem;
=======
font-size: 15px;
color: rebeccapurple;
font-weight: 600;
}
.infowindow-address {
font-size: 8px;
}
.infowindow-btn {
font-size: 8px;
>>>>>>> release_v0.2.0
}
\ No newline at end of file
......
......@@ -4,8 +4,13 @@
var container = document.getElementById('map'); //지도를 담을 영역의 DOM 레퍼런스
var options = { //지도를 생성할 때 필요한 기본 옵션
<<<<<<< HEAD
center: new kakao.maps.LatLng(37.54, 126.96), //지도의 중심좌표.
level: 7 //지도의 레벨(확대, 축소 정도)
=======
center: new kakao.maps.LatLng(37.248, 127.08), //지도의 중심좌표.
level: 4 //지도의 레벨(확대, 축소 정도)
>>>>>>> release_v0.2.0
};
var map = new kakao.maps.Map(container, options); //지도 생성 및 객체 리턴
......@@ -18,6 +23,7 @@
* 2. 데이터 준비하기(제목, 주소, 카테고리)
*/
<<<<<<< HEAD
const dataSet = [
{
title: "희락돈까스",
......@@ -53,6 +59,46 @@ const dataSet = [
// }
// getDataSet();
=======
// const dataSet = [
// {
// title: "희락돈까스",
// address: "서울 영등포구 양산로 210",
// category: "양식",
// },
// {
// title: "즉석우동짜장",
// address: "서울 영등포구 대방천로 260",
// category: "한식",
// },
// {
// title: "아카사카",
// address: "서울 서초구 서초대로74길 23",
// category: "일식",
// }
// ];
async function getDataSet(category) {
let qs = category;
if(!qs) {
qs = "";
}
const dataSet = await axios({
method: "get", // http method
url: `http://localhost:3000/restaurants?category=${qs}`,
headers: {},
data: {},
});
// console.log(dataSet);
return dataSet.data.result;
}
// }
getDataSet();
>>>>>>> release_v0.2.0
/******************************************************************************
* 3. 여러개 마커찍기
......@@ -75,7 +121,11 @@ const dataSet = [
});
}
<<<<<<< HEAD
setMap(dataSet);
=======
// setMap(dataSet);
>>>>>>> release_v0.2.0
/*
*************************************************************
......@@ -170,6 +220,10 @@ const dataSet = [
const categoryId = event.target.id;
const category = categoryMap[categoryId];
<<<<<<< HEAD
=======
>>>>>>> release_v0.2.0
try {
// 데이터 분류
let categorizedDataSet = await getDataSet(category);
......@@ -194,6 +248,7 @@ const dataSet = [
}
}
<<<<<<< HEAD
setMap(dataSet);
// async function setting() {
......@@ -206,4 +261,16 @@ const dataSet = [
// }
// }
// setting();
\ No newline at end of file
// setting();
=======
async function setting() {
try {
const dataSet = await getDataSet();
setMap(dataSet);
} catch (error) {
console.error(error);
}
}
setting();
>>>>>>> release_v0.2.0
......
"use strict";
const socketIO = require("socket.io");
const http = require("http");
const app = express();
const server = http.createServer(app);
const io = socketIO(server);
const socket = io();
//.connect("http://localhost:3000/chat", {transports:['websocket']});
const nickname = document.querySelector("#nickname")
const chatlist = document.querySelector(".chatting-list")
const chatInput = document.querySelector(".chatting-input")
const sendButton = document.querySelector(".send-button")
const displayContainer = document.querySelector(".display-container")
chatInput.addEventListener("keypress", (event)=> {
if(event.keyCode === 13) {
send()
}
})
function send() {
const param = {
name: nickname.value,
msg: chatInput.value
}
socket.emit("chatting", param)
}
sendButton.addEventListener("click", send)
socket.on("chatting", (data)=>{
console.log(data)
const {name, msg, time} = data;
const item = new LiModel(name, msg, time);
item.makeLi()
displayContainer.scrollTo(0, displayContainer.scrollHeight)
})
//console.log(socket);
function LiModel(name, msg, time) {
this.name = name;
this.msg = msg;
this.time = time;
this.makeLi = ()=>{
const li = document.createElement("li");
li.classList.add(nickname.value === this.name ? "sent":"received")
const dom = `<span class="profile">
<span class="user">${this.name}</span>
<img class="image" src="https://placeimg.com/50/50/any" alt="any">
</span>
<span class="message">${this.msg}</span>
<span class="time">${this.time}</span>`;
li.innerHTML = dom;
chatlist.appendChild(li)
}
}
\ No newline at end of file
......@@ -12,6 +12,10 @@ function login() {
password : password.value,
};
<<<<<<< HEAD
=======
// console.log("login value : ", id.value);
>>>>>>> release_v0.2.0
fetch("/login", {
method: "POST",
headers: {
......
......@@ -12,7 +12,10 @@ async function register() {
if(!id.value) {
return alert("아이디를 입력해주세요.")
}
<<<<<<< HEAD
=======
>>>>>>> release_v0.2.0
if(!name.value) {
return alert("이름을 입력해주세요.")
}
......@@ -25,13 +28,18 @@ async function register() {
if (password.value !== confirmPassword.value) {
return alert("비밀번호가 일치하지 않습니다.")
}
<<<<<<< HEAD
=======
>>>>>>> release_v0.2.0
const req = {
id: id.value,
name: name.value,
password: password.value,
};
<<<<<<< HEAD
console.log("id : ", req.id);
try {
const response = await fetch("/register", {
......@@ -45,5 +53,39 @@ async function register() {
} catch(e) {
console.log(e);
}
=======
fetch("/register", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(req),
})
.then((res) => res.json())
.then((res) => {
if (res.success) {
location.href = "/login";
} else {
if (res.err) return alert(res.err);
alert(res.msg);
}
})
.catch((err) => {
console.error("회원가입 중 에러 발생");
});
// try {
// const response = await fetch("/register", {
// method: "POST",
// headers: {
// "Content-Type": "application/json"
// },
// body: JSON.stringify(req),
// });
// console.log("테스트 : ", response);
// } catch(e) {
// console.log(e);
// }
>>>>>>> release_v0.2.0
}
\ No newline at end of file
......
......@@ -16,6 +16,13 @@ const output = {
res.render("home/register");
},
<<<<<<< HEAD
=======
chat: (req, res) => {
res.render("home/chat");
},
>>>>>>> release_v0.2.0
// restaurants: (req, res) => {
// res.render("home/restaurants");
// }
......@@ -31,6 +38,10 @@ const process = {
register: async (req, res) => {
const user = new User(req.body);
const response = await user.register();
<<<<<<< HEAD
=======
// console.log("req.body", req.body);
>>>>>>> release_v0.2.0
// console.log(res.json(response));
// console.log(res.json(response).statusCode); => 이거도 잘 찍혔음.
return res.json(response);
......
......@@ -6,10 +6,19 @@ const jwtMiddleware = require("../../config/jwtMiddleware");
// const Restaurant = require("../../models/Restaurant");
const ctrl = require("./home.ctrl");
<<<<<<< HEAD
=======
const index = require("../../models/Restaurant");
>>>>>>> release_v0.2.0
router.get("/", ctrl.output.hello);
router.get("/login", ctrl.output.login);
router.get("/register", ctrl.output.register);
<<<<<<< HEAD
=======
router.get("/restaurants", index.readRestaurants);
router.get("/chat", ctrl.output.chat);
>>>>>>> release_v0.2.0
// router.get("/restaurants", Restaurant.restaurants);
// router.get("/restaurants", ctrl.output.restaurants);
......
......@@ -4,7 +4,37 @@
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<<<<<<< HEAD
<title>채팅</title>
</head>
<body></body>
=======
<title>채팅방</title>
<link rel="stylesheet" href="/css/home/chat.css" />
</head>
<body>
<div class="wrapper">
<div class="user-container">
<lable class="nickname" for="nickname">닉네임설정</lable>
<input type="text" id="nickname" />
</div>
<div class="display-container">
<ul class="chatting-list"></ul>
</div>
<div class="input-container">
<span>
<input type="text" class="chatting-input" />
<button class="send-button">전송</button>
</span>
</div>
</div>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.5.1/socket.io.js"
integrity="sha512-9mpsATI0KClwt+xVZfbcf2lJ8IFBAwsubJ6mI3rtULwyM3fBmQFzj0It4tGqxLOGQwGfJdk/G+fANnxfq9/cew=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script src="/js/home/chat.js"></script>
</body>
>>>>>>> release_v0.2.0
</html>
......
......@@ -9,14 +9,22 @@
<meta name="description" content="맛집지도 서비스" />
<meta name="keywords" content="맛집지도, 맛집추천, 실시간채팅" />
<link rel="stylesheet" href="/css/home/index.css" />
<<<<<<< HEAD
<script src="/js/home/axios-index.js"></script>
=======
<link rel="stylesheet" href="/css/home/map.css" />
>>>>>>> release_v0.2.0
</head>
<body>
<nav>
<div class="inner">
<div class="nav-container">
<h1 class="nav-title">맛집지도</h1>
<<<<<<< HEAD
<button class="nav-contact">Chatting Rooms</button>
=======
<button class="nav-contact">Contact : balljm@naver.com</button>
>>>>>>> release_v0.2.0
</div>
</div>
</nav>
......@@ -49,11 +57,20 @@
type="text/javascript"
src="//dapi.kakao.com/v2/maps/sdk.js?appkey=e55f753363b95e27b799aa6286a6c398&libraries=services"
></script>
<<<<<<< HEAD
<!-- <script
=======
<script
>>>>>>> release_v0.2.0
src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.0.0-alpha.1/axios.min.js"
integrity="sha512-xIPqqrfvUAc/Cspuj7Bq0UtHNo/5qkdyngx6Vwt+tmbvTLDszzXM0G6c91LXmGrRx8KEPulT+AfOOez+TeVylg=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
<<<<<<< HEAD
></script> -->
=======
></script>
<script src="/js/home/axios-index.js"></script>
>>>>>>> release_v0.2.0
</body>
</html>
......