apparentlymart/angularjs-server — pull request #7 by apparentlymart (2013-12-05 20:17:52+00:00)
Title: Simplify the interface for building Angular-aware middlewares.

After getting some experience with writing middlewares that make use of this module, we learned that every middleware ends up creating an injector, setting the request on it, and then disposing the context at the end.

This is a breaking change to switch to a more convenient interface where the middleware receives an injector directly, and the context is automatically disposed when the request ends. This means that in the common case a middleware function has less boilerplate and can concentrate on whatever unique logic it's providing. The main 'angular' object is still available via an extension property $injector.angular.

After this change, a wrapped middleware has this signature:

```js
function someMiddleware(request, response, next, $injector) {
...
request.end(...); // automatically disposes the AngularJS context
}
```