Is there any specific order of app.router , express.urlencoded and express.static(__public + "/public");
Problem
Is there any Specific order in which these three commands should be written in the app.configure
function?
app.use(express.urlencoded());
app.use(app.router);
app.use(express.static(__dirname + '/public'));
I am asking this because when I change their order , I sometimes get an ENOENT
error or some middleware doesn't work.
Problem courtesy of: Raman Singh
Solution
So in the default app.js file express creates the order is
app.use(express.bodyParser()); // or app.use(express.urlencoded())
app.use(app.router);
app.use(express.static(__dirname + "/public"));
So I guess this is the right way...
Solution courtesy of: Raman Singh
Discussion
View additional discussion.