Skip to content
vevo-demetrius-johnson edited this page Jan 23, 2015 · 3 revisions

Request get passed to the router. Pellet will create a isomorphic router for the server and browser environments. In the server environment if your page/layout/route component has a static componentConstruction method it will create a pipeline. This allows pellet to fetch and setup any data needed before rendering.

In side of the componentConstruction method pellet will expose a handful of methods that match react functions and the pellet mixins functions. For example this.setProps will update the pipelines version of props. In addition pellet creates isolated data that is isolated to each request. This allows private unshared data to be passed around while pellet is executing code in componentConstruction. This is very much the same as having a nodejs req,res object passed around to each function. You can get it via this.getIsolatedConfig().

The isolatedConfig is passed to coordinator so the private data is accessible inside of coordinators. This lets your coordinators to access this data via this.isolatedConfig.

NOTE: in the browser the isolatedConfig is shared, because it is technically all the same request. On the server each request gets a new unique isolatedConfig.

On the server the pipeline has access to:

  • http - isomorphic wrapper for handling the req/res i.e header, statusCode, redirect, and cookies
  • requestContext - this is a way for the server side code to add information that is passed to the client. This is useful if you need your isomorphic code to share a variable like geo location. The only way to determine the geo location is reverse lookup that can only be done on the server, so the server can add this information to the requestContext and it will be serialize to the client and make available in the pipeline and component.
  • locales - the current targeted locale (the lang we need to render as)

On the server side you can update this.abortRender to tell pellet to skip the react render. This is helpful if you need to send redirects or stop execution.

Clone this wiki locally