Tuesday 23 May 2017

How app.use() works in express 4.x?

I have used this code in my app.js file:

    var index = require('./routes/index');
var users = require('./routes/users');
var catalog = require('./routes/catalog');
...
...
app.use('/', index);
app.use('/users', users);
app.use('/catalog', catalog);

and when i am debugging it, it is giving the error of middleware function. I searched about it and found about some changes made in express 4.x with respect to last version. I tried to change it many ways but error is still existing. Can anyone tell how should i change my code to get past this error?enter image description here Thanks



via Dheeraj Kumar

No comments:

Post a Comment