Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

This can no longer be used as middleware via app.use() #23

Open
ericf opened this issue May 3, 2013 · 4 comments · May be fixed by #24
Open

This can no longer be used as middleware via app.use() #23

ericf opened this issue May 3, 2013 · 4 comments · May be fixed by #24
Assignees
Labels

Comments

@ericf
Copy link
Contributor

ericf commented May 3, 2013

Express middleware used via app.use() requires a function, this commit bc842d9 made combo.combine() always return an array.

@ghost ghost assigned evocateur May 3, 2013
@ericf
Copy link
Contributor Author

ericf commented May 3, 2013

Also, I'm unsure that even the implementation in <= 0.2.1 would even work in Express 3.x since the handler function always calls next() which will lead to a 404 since res.send() was never called.

@evocateur
Copy link
Collaborator

Oh, dang. Guess we should have a test for that case.

I'll have to do some digging to figure out when we know we're being used directly, vs in a route callback chain...

@ericf
Copy link
Contributor Author

ericf commented May 4, 2013

I think it's fine to add a new function to serve this feature which basically would have to manually call into the other middleware functions and can't rely on next().

@evocateur
Copy link
Collaborator

Yeah, I have an angle on inspecting the req.route.callbacks array, see if the current middleware is the end of the chain, and then just res.send(res.body) instead of next(). I fiddled with it a couple weeks ago (hence naming some of the anonymous functions returned as middleware), it's crazy what Express gives access to in the req and res objects.

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

Successfully merging a pull request may close this issue.

2 participants