I want to separate my route file in nodejs. I use restify framework and this is part of my code:
app.routes((app)=>{
require(__dirname + '/../routes/web.js')
})
routes/web.js:
app.get('/', function (req, res, next) {
console.log("object");
})
When run the program I get this error:
app is not a defined
How can I fix that?
In web.js app
is undefined
while I sended it to function.