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

resizing Telegram inline keyboard -

javascript - How to bind ViewModel Store to View? -

javascript - Solution fails to pass one test with large inputs? -