airbnb/rendr — pull request #256 by lxanders (2014-01-10 13:11:16+00:00)
Title: Fix serverSync to use apiProxy logic in the same way the clientSync does

Formerly the `serverSync` method in `syncer.js` used the `dataAdapter` to request data from an api host. This is a problem as e.g. the `x-forward-for` header is only set in the `apiProxy`. The `serverSync` method should work the same way as the `clientSync` method which already uses the `apiProxy`.

We extracted the proxy request logic to a reusable method `proxyRequest` stored in the `apiProxyMiddleware`. Additionally we added the `res` object to the global `app` object in the same way the `req` object is already being added to it, to allow a custom `apiProxy` making use of the `res` object.

One additional advantage would be the decoupling of the `dataAdapter` from the `syncer` which e.g. makes it simple to implement support for multiple `dataAdapter`s (e.g. for REST and for SOAP).

CC: @c089, @selaux, @lo1tuma