1

I'm looking at the connect documentation, and there doesn't appear to be any documentation on the .use method or anything that describes what next() does (the secret 3rd parameter to use). Am I blind, or where can I find this info?

Chenmunka
  • 685
  • 4
  • 21
  • 25
mpen
  • 272,448
  • 266
  • 850
  • 1,236
  • 1
    You aren't blind. Check out the documentation for [Express](http://expressjs.com) what works there should work with connect - express uses connect. – dc5 Aug 31 '13 at 05:57

1 Answers1

2

Did you checked this documentation:- http://www.senchalabs.org/connect/proto.html#app.use

next() is naming convention used when passing callbacks

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
  • 1
    How did you find that? Doesn't appear to be linked from the homepage. – mpen Aug 31 '13 at 05:59
  • 1
    Its not that you are blind. You tried with Google and I trusted Stackoverflow!!!! :) http://stackoverflow.com/questions/11321635/node-js-express-what-is-app-use – Rahul Tripathi Aug 31 '13 at 06:01
  • I thought Express was built on Connect, not the other way around...seems odd that the derived library should document it, but not the base. Or...maybe I'm misunderstanding. Connect is just a bunch of middleware of Express? – mpen Aug 31 '13 at 06:03
  • 1
    @Mark You're correct that Express is built on Connect, but not that Express defines any middleware. Express is primarily the router while the built-in middleware generally comes from Connect and [is just copied](https://github.com/visionmedia/express/blob/3.3.7/lib/express.js#L41-L51). The [copies in the documentation](http://expressjs.com/api.html#middleware) are for convenience. – Jonathan Lonowski Aug 31 '13 at 08:13