Skip to content

Commit

Permalink
Merge branch 'main' of github.com:HiAlcohol/HiAlcohol_server
Browse files Browse the repository at this point in the history
  • Loading branch information
AYoungSn committed Dec 6, 2021
2 parents 15288c4 + 0ab2125 commit 0588f5a
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 103 deletions.
17 changes: 16 additions & 1 deletion config/product.sql
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,19 @@ INSERT INTO `product`
VALUES (NULL, '', '골드 오브 모리셔스');

INSERT INTO `product`
VALUES(NULL, '', '엘 도라도');
VALUES(NULL, '', '엘 도라도');

INSERT INTO `product`
VALUES(NULL, '드라이진', '봄베이 사파이어');

INSERT INTO `product`
VALUES(NULL, '드라이진', '고든스');

INSERT INTO `product`
VALUES(NULL, '드라이진', '비피터');

INSERT INTO `product`
VALUES(NULL, '드라이진', '런던 드라이 진');

INSERT INTO `product`
VALUES(NULL, '드라이진', '라리오스');
25 changes: 22 additions & 3 deletions routes/search_listRouter.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
const express = require('express');
const router = express.Router();
const search_list = require('../template/search_list.js');
const mysql = require('mysql');

router.get('/', function(request, response) {
const body = search_list.HOME();
response.send(search_list.HTML(body));
var url = require('url');

var db = mysql.createConnection({
host:'localhost',
user:'root',
password:'root',
database:'hialcohol'
});
db.connect();

router.get('/', function(request, response){
db.query(`select * from recipe`, function(err, result){
if (err) throw err;
var id = result[0].id;
var cocktail = result[0].cocktail;

var list = search_list.LIST(result)
var html = search_list.HTML(id, cocktail, list)

response.send(html);
});
});

module.exports = router;
227 changes: 128 additions & 99 deletions template/search_list.js
Original file line number Diff line number Diff line change
@@ -1,120 +1,125 @@
module.exports = {
HTML: function(body) {
HTML: function(id, cocktail, list) {
const head = this.HEAD();
const tail = this.TAIL();

return `
${head}
${body}
${tail}
`
},
HOME: function() {
return `
<header>
<!-- hamburger menu -->
<div class="menu_btn">
<a href="#">
<div class="container">
<div class="bar1"></div>
<div class="bar2"></div>
<div class="bar3"></div>
<!-- <img src="menuIcon.png" width="40px" /> -->
</div>
</a>
</div>
<div class="menu_bg"></div>
<div class="sidebar_menu">
<div class="close_btn">
<header>
<!-- hamburger menu -->
<div class="menu_btn">
<a href="#">
<div class="container">
<div
class="change bar1 a"
style="
-webkit-transform: rotate(-45deg) translate(-1px, 1px);
transform: rotate(-45deg) translate(-1px, 1px);
"
></div>
<div
class="bar3 change b"
style="
-webkit-transform: rotate(45deg) translate(-4px, -4px);
transform: rotate(45deg) translate(-4px, -4px);
"
></div>
<div class="bar1"></div>
<div class="bar2"></div>
<div class="bar3"></div>
<!-- <img src="menuIcon.png" width="40px" /> -->
</div>
<!-- <img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMjMuOTU0IDIxLjAzbC05LjE4NC05LjA5NSA5LjA5Mi05LjE3NC0yLjgzMi0yLjgwNy05LjA5IDkuMTc5LTkuMTc2LTkuMDg4LTIuODEgMi44MSA5LjE4NiA5LjEwNS05LjA5NSA5LjE4NCAyLjgxIDIuODEgOS4xMTItOS4xOTIgOS4xOCA5LjF6Ii8+PC9zdmc+"> -->
</a>
</div>
<div class="menu_wrap">
<div><a href="#">꿀조합 게시판</a></div>
<div><a href="#">우리동네 주류매장</a></div>
<div><a href="#">내가 쓴 꿀조합</a></div>
<div><a href="#">좋아요 리스트</a></div>
<div><a href="#">로그아웃</a></div>
<div class="menu_bg"></div>
<div class="sidebar_menu">
<div class="close_btn">
<a href="#">
<div class="container">
<div
class="change bar1 a"
style="
-webkit-transform: rotate(-45deg) translate(-1px, 1px);
transform: rotate(-45deg) translate(-1px, 1px);
"
></div>
<div
class="bar3 change b"
style="
-webkit-transform: rotate(45deg) translate(-4px, -4px);
transform: rotate(45deg) translate(-4px, -4px);
"
></div>
</div>
<!-- <img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMjMuOTU0IDIxLjAzbC05LjE4NC05LjA5NSA5LjA5Mi05LjE3NC0yLjgzMi0yLjgwNy05LjA5IDkuMTc5LTkuMTc2LTkuMDg4LTIuODEgMi44MSA5LjE4NiA5LjEwNS05LjA5NSA5LjE4NCAyLjgxIDIuODEgOS4xMTItOS4xOTIgOS4xOCA5LjF6Ii8+PC9zdmc+"> -->
</a>
</div>
<div class="menu_wrap">
<div><a href="#">꿀조합 게시판</a></div>
<div><a href="#">우리동네 주류매장</a></div>
<div><a href="#">내가 쓴 꿀조합</a></div>
<div><a href="#">좋아요 리스트</a></div>
<div><a href="#">로그아웃</a></div>
</div>
</div>
</div>
<h2 style="font-family: 'Pattaya', sans-serif; color: #0bf3bc">
Hi Alcohol
</h2>
</header>
<main>
<!-- 검색창 -->
<div class="search">
<input type="text" name="searchtxt" placeholder="술 이름을 입력해주세요.">
<button type="submit" onclick=" location.href='search.html'">
<i class="fas fa-search" style="font-size: 20px;"></i>
</button>
</div>
<!-- 검색 결과 리스트(반복될 요소) -->
<div class="list" id="list1">
<a href="">내 마음대로 주</a>
<div class="recipe" id="btn1">></div>
<br><br>
<div class="input">
<div>체리</div>
<div>맥콜</div>
<div>사이다</div>
<div>소주</div>
<div>깔라만씨 토닉워터</div>
<div>토닉워터</div>
<div>토닉워터</div>
<h2 style="font-family: 'Pattaya', sans-serif; color: #0bf3bc">
Hi Alcohol
</h2>
</header>
<main>
<!-- 검색창 -->
<div class="search">
<input type="text" name="searchtxt" placeholder="술 이름을 입력해주세요.">
<button type="submit" onclick=" location.href='search.html'">
<i class="fas fa-search" style="font-size: 20px;"></i>
</button>
</div>
</div>
<!-- 검색 결과 리스트(반복될 요소) -->
${list}
</main>
<!-- 모달창(칵테일 레시피) -->
<div id="modal-overlay"></div>
<div id="modal">
<div class="modal-window">
<div class="title">
<h2 style="color: white">내 마음대로 주</h2>
<div class="modal_close">X</div>
</div>
<div class="content">
<div class="list" id="list1">
<a href="">내 마음대로 주</a>
<div class="recipe" id="btn1">></div>
<br><br>
<div class="input">
<div>체리</div>
<div>맥콜</div>
<div>사이다</div>
<div>소주</div>
<div>깔라만씨 토닉워터</div>
<div>토닉워터</div>
<div>토닉워터</div>
</div>
</div>
</main>
<!-- 모달창(칵테일 레시피) -->
<div id="modal-overlay"></div>
<div id="modal">
<div class="modal-window">
<div class="title">
<h2 style="color: white">내 마음대로 주</h2>
<div class="modal_close">X</div>
</div>
<h3 style="color: white">소주 5 : 맥주 1 : 사이다 0.1</h3>
<ol>
<li>소주를 한 병 넣는다.</li>
<li>소주를 두 병 넣는다.</li>
<li>소주를 세 병 마시면서 쉰다.</li>
<li>소주를 네 병 넣는다.</li>
<li>소주를 다섯 병 넣고 섞어서 원샷한다.</li>
</ol>
<div class="content">
<div class="input">
<div>${id}</div>
<div>맥콜</div>
<div>사이다</div>
</div>
<h3 style="color: white">소주 5 : 맥주 1 : 사이다 0.1</h3>
<ol>
<li>소주를 한 병 넣는다.</li>
<li>소주를 두 병 넣는다.</li>
<li>소주를 세 병 마시면서 쉰다.</li>
<li>소주를 네 병 넣는다.</li>
<li>소주를 다섯 병 넣고 섞어서 원샷한다.</li>
</ol>
</div>
</div>
</div>
</div>
${tail}
`
},
HOME: function() {
return `
`
},
HEAD: function() {
Expand All @@ -140,5 +145,29 @@ module.exports = {
</body>
</html>
`
}
};
},
LIST: function(result) {
var list = '<ul>';
var i = 0;
while(i<result.length){

list = list +
`
<div class="list" id="list1">
<a href="">${result[i].cocktail}</a>
<div class="recipe" id="btn1">></div>
<br><br>
<div class="input">
<div>${result[i].id}</div>
</div>
</div>
`;
i = i+1;
}
list = list + '</ul>';
return list;
}
};

`
`;

0 comments on commit 0588f5a

Please sign in to comment.