If you created your app
with the usual call to createServer()
, then there is no other way to access the parameter settings without going through the object returned by this function. Express does not cache the server object, but simply returns the result of the new
object.
If you created your application with the standard express template template generated for you, you will likely have a line creating an app
that looks like this:
var app = module.exports = express.createServer();
This does not actually create the app
as a global variable, but makes it available as a module export. You can access your mailTemplatesDir
option from another module by requiring your app.js
module as follows:
var templateDir = require('./app').set('mailTemplatesDir');
source share