Menu

Using ReactServerAgent

Using ReactServerAgent

ReactServerAgent is used to handle data requests with React Server. It has methods for requests using the most common http methods. Under the covers, ReactServerAgent uses SuperAgent to handle its requests and responses, so much of the api will be familiar to users of SuperAgent. If you see an error from ReactServerAgent that says "$Method from superagent's API isn't implemented yet", please submit an issue requesting it.

Extending SuperAgent

ReactServerAgent provides two points at which to extend SuperAgent: plugRequest and plugResponse. These methods are called to modify the request or response object before the request is triggered, or before the resonse is passed to the callers callback. See the api docs for more details.

How do I find out more?

The best place to learn more about how to write middleware is by looking at core/ReactServerAgent.js. You might also check out the other parts of ReactServerAgent: