divshot/superstatic — pull request #65 by joshrowley (2014-04-30 19:39:26+00:00)
Title: Custom middleware arguments

Connect's `use` function can also [accept a string as the first argument](https://github.com/senchalabs/connect/blob/master/lib/proto.js#L43-L46) in order to mount the middleware on a specific route. Currently superstatic only accepts one argument (a function), this passes all arguments given to superstatic's `use` into the connect object.

We have superstatic working great with roots in https://github.com/jenius/roots/pull/451. The only issue we had was with websockets which requires us to attach event listeners to the connect instance, so I ended up needing to reimplement superstatic's `server.start` method in order to attach the event listeners (details [here](https://github.com/joshrowley/roots/commit/3df3eda8711db676ad39f926ee59b5f691c0020f)).

As previously discussed, I think it would worthwhile to extend superstatic directly from the connect object. This would give superstatic a very familiar and compatible API for use in other projects. Are you guys still interested in adding this in? I think we'll be poking around and working on this on our own fork, just seeing what your thoughts were.