Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sebastien-p opened this issue Jul 29, 2013 · 2 comments
Open

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

sebastien-p opened this issue Jul 29, 2013 · 2 comments

Comments

@sebastien-p
Copy link

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
Copy link
Owner

hmm, wonder if this is also causing #30 ?

@protobi
Copy link

protobi commented Jul 25, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants