Middleware in the router?

Is the main application file - app.js.
It is connected to, for example, middleware:
app.enable('trust proxy');
app.use(helmet());
app.use(compression());


Next, connect the router:
var baseRouter = require('./routes/baseRouter.js');
app.use('/', baseRouter);


Question. middleware from app.js will already be working for the router baseRouter.js? Or you need to duplicate inside baseRouter.js?
June 8th 19 at 16:42
1 answer
June 8th 19 at 16:44
Solution

Find more questions by tags Node.js