**app.get('/', (req,res)=>{
res.send('Api is running...');
})
app.use('/api/products/', productRoutes);
app.use(notFound);
app.use(errorHandler);**
Above is the gist of my code where app.use(notFound) and app.use(errorHandler) are middleware. This pattern works perfectly fine. However when i interchange the position of the command to below then there is a break in the application. are middlewares to be placed at the bottom? please help me here to clear my confusion.
**app.get('/', (req,res)=>{
res.send('Api is running...');
})
app.use(notFound);
app.use(errorHandler);
app.use('/api/products/', productRoutes);**