From b1548a33b1feb439828c856cf5aa6df431d24928 Mon Sep 17 00:00:00 2001 From: Ahn YoungSeon Date: Tue, 7 Dec 2021 21:51:51 +0900 Subject: [PATCH] =?UTF-8?q?#17=20db=20connection=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/db.js | 7 ------- routes/search_listRouter.js | 17 +++++++++-------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/config/db.js b/config/db.js index 755c8be..befee3e 100644 --- a/config/db.js +++ b/config/db.js @@ -7,12 +7,5 @@ const db = mysql.createConnection({ database: 'hialcohol' }); -// const db = new mysql({ -// host: 'localhost', -// user: 'root', -// password: 'qwerty123', -// database: 'hialcohol' -// }); - db.connect(); module.exports = db; \ No newline at end of file diff --git a/routes/search_listRouter.js b/routes/search_listRouter.js index 7758f98..8be4b41 100644 --- a/routes/search_listRouter.js +++ b/routes/search_listRouter.js @@ -1,17 +1,18 @@ const express = require('express'); const router = express.Router(); const search_list = require('../template/search_list.js'); -const mysql = require('mysql'); +// const mysql = require('mysql'); +const db = require('../config/db') var url = require('url'); -var db = mysql.createConnection({ - host:'localhost', - user:'root', - password:'root', - database:'hialcohol' -}); -db.connect(); +// 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){