how to export app object in express?
express, javascript, node.js
Solution
You can use `request` object:
// inside reg.js:
console.log( req.app );
Problem
I init my app object in app.js: ``` var app = express(); var reg = require('./routes/reg'); app.use('/reg',reg); ... ... module.exports = app; ``` and I call app.get() in reg.js: ``` var app = require("../app.js"); ... ... app.get("jwtTokenSecret"); ``` my files are like this in the project: ``` ---app.js ---routes ---reg.js ``` but I found that app is {} in reg.js and the app.get() is not a function, so how to solve it? thanks a lot