Created
September 18, 2013 04:04
-
-
Save facultymatt/6604414 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A design pattern for a mean.io notifier module | |
var transport = null; // will store our connection to nodemailer | |
var actions = ['generate_quote', 'generate_application', 'submit_application']; // actions allowed to email | |
// There is no model | |
exports.initModel() {} | |
// There are no routes | |
exports.initRoutes() {} | |
exports.init(app, config) { | |
// create transport from config settings | |
// save transport | |
} | |
// call to send an email | |
// action will determine which template to use | |
// options should be the options object as required by template and nodemailer | |
exports.notify(action, options) { | |
// check for valid action | |
// attempt to generate template | |
// template success, send email with nodemailer transport | |
// optionally send other notification options as needed | |
} | |
// render template | |
generateTemplate(options, cb) {} | |
sendEmail(options, cb) {} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment