forked from shubdev07/quiz15
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
38 lines (32 loc) · 908 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';
const mongoose = require('mongoose');
const nodemailer = require('nodemailer');
if(process.env.NODE_ENV !== 'production') {
require('dotenv').config();
}
const CONFIGURATION = {
SMTP_HOST: process.env.SMTP_HOST,
SMTP_LOGIN: process.env.SMTP_LOGIN,
SMTP_PASSWORD: process.env.SMTP_PASSWORD,
DB_URI: process.env.DB_URI,
ENV: process.env.NODE_ENV,
PORT: process.env.PORT
};
mongoose.Promise = global.Promise;
mongoose.connection.openUri(process.env.DB_URI, {config: {autoIndex: false}});
mongoose.connection.on('error', function(err) {
console.log('MongoDB Connection Error');
process.exit(-1);
});
/*let mailTransporter = nodemailer.createTransport({
host: CONFIGURATION.SMTP_HOST,
secure: true,
auth: {
user: CONFIGURATION.SMTP_LOGIN,
pass: CONFIGURATION.SMTP_PASSWORD
},
tls: {
rejectUnauthorized: false
}
});*/
module.exports = {CONFIGURATION};