Showing
4 changed files
with
22 additions
and
1 deletions
boiler-plate/.gitignore
0 → 100644
boiler-plate/config/key.js
0 → 100644
1 | +// development모드이면 process.env.NODE_ENV는 development라고 나오고 | ||
2 | +// production모드이면 production이라고 나옴 | ||
3 | +if(process.env.NODE_ENV === 'production') // === 는 형변환을 하지 않음. | ||
4 | + // ex) true == 1 -> return true | ||
5 | + // true === 1 -> return false | ||
6 | +{ | ||
7 | + module.exports = require('./prod') | ||
8 | +} | ||
9 | + | ||
10 | +else | ||
11 | +{ | ||
12 | + module.exports = require('./dev') | ||
13 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
boiler-plate/config/prod.js
0 → 100644
... | @@ -11,9 +11,12 @@ const bodyParser = require('body-parser') | ... | @@ -11,9 +11,12 @@ const bodyParser = require('body-parser') |
11 | app.use(bodyParser.urlencoded({extended: true})) //application/x-www-form-urlencoded로 된 데이터를 분석해서 가져옴 | 11 | app.use(bodyParser.urlencoded({extended: true})) //application/x-www-form-urlencoded로 된 데이터를 분석해서 가져옴 |
12 | app.use(bodyParser.json()) // application/json 타입으로 된 데이터를 분석해서 가져옴 | 12 | app.use(bodyParser.json()) // application/json 타입으로 된 데이터를 분석해서 가져옴 |
13 | 13 | ||
14 | +const config = require('./config/key') | ||
15 | + | ||
14 | const mongoose = require('mongoose') | 16 | const mongoose = require('mongoose') |
15 | 17 | ||
16 | -mongoose.connect('mongodb+srv://mindyeoi:aaa111@boilerplate.djq4a.mongodb.net/myFirstDatabase?retryWrites=true&w=majority', { | 18 | +//이 정보는 비밀임..! 몽고DB아이디랑 비밀번호를 감춰야해..! |
19 | +mongoose.connect(config.mongoURI, { | ||
17 | useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true, useFindAndModify: false | 20 | useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true, useFindAndModify: false |
18 | }).then(()=>console.log('MongoDB Connected...')) | 21 | }).then(()=>console.log('MongoDB Connected...')) |
19 | .catch(err => console.log(err)) | 22 | .catch(err => console.log(err)) | ... | ... |
-
Please register or login to post a comment