index.js 1.04 KB
Newer Older
Ha YeaJin's avatar
pages    
Ha YeaJin committed
1
2
3
4
5
6
7
const mongoose = require('mongoose');

module.exports = () => {
    const connect = () => {
        if (process.env.NODE_ENV !== 'production') {
            mongoose.set('debug', true);
        }
8
<<<<<<< HEAD
Lee Jin Ju's avatar
Lee Jin Ju committed
9
        mongoose.connect('mongodb://hijinju:highlight@localhost:27017/admin', {
10
=======
Choi Ga Young's avatar
Choi Ga Young committed
11
        mongoose.connect('mongodb://rkyoung7:rkdud127@localhost:27017/admin', {
12
>>>>>>> origin/rkyoung7
Ha YeaJin's avatar
pages    
Ha YeaJin committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
            dbName: 'KU_Rental',
        }, (error) => {
            if (error) {
                console.log('몽고디비 연결 에러', error);
            } else {
                console.log('몽고디비 연결 성공');
            }
        });
    };
    connect();
    mongoose.connection.on('error', (error) => {
        console.error('몽고디비 연결 에러', error);
    });
    mongoose.connection.on('disconnected', () => {
        console.error('몽고디비 연결이 끊겼습니다. 연결을재시도합니다.');
        connect();
    });
    require('./user');
    require('./reserve');

33
<<<<<<< HEAD
Ha YeaJin's avatar
pages    
Ha YeaJin committed
34
};
35
36
37
=======
};
>>>>>>> origin/rkyoung7