Skip to content

Commit

Permalink
#17 db connection 정보 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
AYoungSn committed Dec 7, 2021
1 parent 330e073 commit b1548a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
7 changes: 0 additions & 7 deletions config/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
17 changes: 9 additions & 8 deletions routes/search_listRouter.js
Original file line number Diff line number Diff line change
@@ -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){
Expand Down

0 comments on commit b1548a3

Please sign in to comment.