node.js - Restify set method like in Express -
in express 4.0, after declaring server following set server-wide variable...
var app = express(); app.set('foo', 'bar');
i don't see method in restify's documentation, i'm declaring object inside server holds variables.
is correct? there better way in restify?
it sounds work, why not create module hold variables? create file named vars.js somewhere appropriate , make this:
module.exports = { my_var: 2112, other_var: 'signals' }
then wherever need access variable
var all_vars = require('./path/to/var.js');
and you'll have them.
Comments
Post a Comment