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

Popular posts from this blog

vb.net - How to ignore if a cell is empty nothing -

Sort a complex associative array in PHP -

recursion - Can every recursive algorithm be improved with dynamic programming? -