jsantell / poet

A node.js blog engine
jsantell.github.io/poet
MIT License
604 stars 146 forks source link

`app.use(app.router);` in examples #39

Open sebastien-p opened 11 years ago

sebastien-p commented 11 years ago

Hello,

Thanks for the great work, Poet is awesome!

Even if not directly a problem due to Poet, I noticed that most of the exemple files contain app.use(app.router);. The thing is, with Express 3, registering a new route will automatically add the router middleware to the stack if not already present. So, doing it explicitly after the Poet instantiation will result in adding a second router middleware to the stack (a simple console.log(app.stack); will show this).

Another issue is that, if one would like to add some middlewares (as order matters) before/after the router one, one would actually instantiate Poet at the bottom right before any additional Express routes if any.

What do you think about that?

jsantell commented 11 years ago

hmm, wonder if this is also causing #30 ?

protobi commented 10 years ago

Aha. Instantiating Poet at the top of app.js caused express multipart file uploads to break, quietly turning req.files into undefined. Moving it to the bottom resolve that nicely.