Hi, I have created a website using Express, like perhaps most of the people who do their first project on Node.js. I find it a simple and convenient stack for basic and moderately complex websites. However, I'm curious to learn of ways to use Express, or any other frameworks that don't have the following limitations:
1. The middleware chains are invoked strictly sequentially and are not very flexible. There are ways to add path-specific middleware, but there doesn't appear to be a convenient way to alter the processing sequence based on per-request conditions. My use case: I don't want to request a potentially expensive connection to the persistent data store, or even invoke bodyParser etc., if the user is not logged in accordingly to the session (stored in Redis), and therefore the request is to be served an invariable file or redirected. My current solution is a wrapper function that checks a condition and passes control to the wrapped middleware or bypasses it, depending on the result. 2. Dependencies between middleware functions are implicit, and resolved by the use order: you've got to know that cookieParser has to be invoked before session, instead of the session middleware declaring it as a dependency so that it's invoked automatically in the correct order, or not invoked at all if session and any other dependent middleware stages were not used for this request, as suggested in point 1. 3. Connect-style middleware does not have a good place to pass intermediate results except hanging them off request or response objects, which can result in property name conflicts. Basically, I'd love to find something that marries Express-style process stage composition with the declarative control flow approach of async.auto, while being more lightweight and elegant than Shepherd or Plan. Regards, Mikhail -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
