Skip to content

Commit

Permalink
code optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
sudarsan ps committed May 2, 2018
1 parent 6b31580 commit 81e192b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions routes/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ router.route('/')

async.waterfall(
[
function(nextFun){
(nextFun)=>{
userFunctions.identityEmailList(function(err,emailList){
nextFun(err,emailList);
});
},
function(emailList,nextFun){
(emailList,nextFun)=>{
userFunctions.identityDomainList(function(err,domainList){
emailList.domainList = domainList
nextFun(err,emailList);
});
},
function(emailList,nextFun){
(emailList,nextFun)=>{
userFunctions.fetchSendQuota(function(err,sendQuota){
emailList.sendQuota = sendQuota
nextFun(err,emailList);
});
},
function(emailList,nextFun){
(emailList,nextFun)=>{
userFunctions.fetchSendStatistics(function(err,sendStatistics){
console.log("sendStatistics:"+JSON.stringify(sendStatistics));
emailList.sendStatistics = sendStatistics
Expand Down
6 changes: 0 additions & 6 deletions routes/sendemail.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ router.route('/')

if(validator.isEmail(toAddress) && validator.isEmail(fromAddress)){

let transporter = nodemailer.createTransport({
SES: new AWS.SES({
apiVersion: process.env.SES_API_VERSION
})
});

transporter.sendMail({
from: fromAddress,
to: toAddress,
Expand Down
6 changes: 6 additions & 0 deletions shared/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ global.nodemailer = require('nodemailer');


global.config = require('../config/config');

global.transporter = nodemailer.createTransport({
SES: new AWS.SES({
apiVersion: process.env.SES_API_VERSION
})
});

0 comments on commit 81e192b

Please sign in to comment.