Skip to content

Commit

Permalink
#29 database config data 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
AYoungSn committed Dec 18, 2021
1 parent 2916e33 commit ba93dfe
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
9 changes: 5 additions & 4 deletions config/db.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
var mysql = require('mysql');
const env = require('./env');

const db = mysql.createConnection({
host: 'localhost',
user: 'root',
password: 'qwerty123',
database: 'hialcohol',
host: env.host,
user: env.user,
password: env.password,
database: env.database,
dateStrings: 'date'
});

Expand Down
7 changes: 7 additions & 0 deletions config/env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
host: 'localhost',
user: 'root',
password: 'qwerty123',
database: 'hialcohol',
port: 3000
};
23 changes: 11 additions & 12 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
const express = require('express');
const app = express();
const port = 3000;
const bodyParser = require('body-parser');
const indexRouter = require('./routes/indexRouter.js')
const session = require('express-session');
const MySQLStore = require('express-mysql-session')(session);
const passport = require('passport');
const flash = require('connect-flash');
const cookieParser = require('cookie-parser');

const indexRouter = require('./routes/indexRouter.js')
const oauthRouter = require('./routes/loginRouter.js');
const likeRouter = require('./routes/likeRouter');
const boardRouter = require('./routes/boardRouter.js')
const search_listRouter = require('./routes/search_listRouter.js');
const mapRouter = require('./routes/mapRouter');
const passport = require('passport');
const flash = require('connect-flash');

const passportConfig = require('./passport');
const cookieParser = require('cookie-parser');
const boardProcessRouter = require('./routes/boardProcessRouter.js');
const env = require('./config/env.js');

const boardProcessRouter = require('./routes/boardProcessRouter.js')
const db = require('./config/db.js')
const port = env.port;

app.use(cookieParser('ras'));
passportConfig();
Expand All @@ -31,11 +30,11 @@ app.use(session({
secure: false,
saveUninitialized: true,
store: new MySQLStore({
host: "localhost",
host: env.host,
port: 3306,
user: "root",
password: "qwerty123",
database: "hialcohol"
user: env.user,
password: env.password,
database: env.database
})
}));
app.use(passport.initialize());
Expand Down

0 comments on commit ba93dfe

Please sign in to comment.