senchalabs/connect — pull request #798 by Rulexec (2013-04-27 23:39:50+00:00)
Title: proto.extend

Hello. I'm proposing to introduce method .extend.

I'm used express.js, but it too "big" for me and with no needed for me features, I'm using only connect's middlewares. And when I tried to create field named "auth" on express request, I failed.

So, I'm think, that I can just don't use express.js and use pure connect.js.

But only middlewares it is not many as needed. And I propose to add "extensions". They just will get connect() object as this and add different functionalities.

In code I'm created very small and non-profit example. [Here](https://gist.github.com/Rulexec/5475181) is more powerful extension (routing too).

Yes, I can just pass connect() object to my function and modify it in it, but it's not chainable good. Also, I can just in every my new project write:

```javascript
var app = connect();
connect.extend = function(extension) {
return extension.call(this), this;
};
```

But it's not very good too.

// Sorry for grammar, I'm working on this.

Thanks!