Express: accessing app.set() settings in routes

前端 未结 2 1651
情书的邮戳
情书的邮戳 2021-01-01 10:11

In Express, I\'m led to believe that global app settings can be created by doing something similar to the following in my main app.js file:

var          


        
相关标签:
2条回答
  • 2021-01-01 10:31

    At the end of your app.js file:

    module.exports = app;
    

    And then in routes/login.js:

    var app = require('../app');
    

    Now you have access to the actual app object and won't get a ReferenceError.

    0 讨论(0)
  • 2021-01-01 10:53

    Use req.app.get('ssoHostname')

    0 讨论(0)
提交回复
热议问题