The Controller

Itsa-server has a controller on the serverside, and can optionally run a controller on the client.

Serverside controller

The serverside controller is active by the framework. You just define your route-file and whenever reply.reactview gets invoked, the view will be rendered with the proper modeldata.

Clientside controller

The clientside controller is active on the client by app.js. It has a property this.controller, but you probably will never need to manage it, because it gets managed by the app its router. If you really need to manage it yourself: the client controller contains the model which also was used on the server, and some other information.

Available methods of the controller

** getComponentId(): returns the unique id of the current page-chunk that webpack created
** getProps(): returns the model-data of the view (available at the server-view with this.props)
** getView(): returns the current view-name
** getLang(): returns the current language that the visiter gets presented
** isStaticView(): whether the current view is static
** getTitle(): current title van de webpage
** getBodyComponent(): current React-Component that is rendered inside the body-element
** getCss(): current css, that belongs with the current React-Component
** setPage({config}): is used to swith the page-content. The argument is an object, containing the next properties: view, BodyComponent, title, props, css, staticView, componentId, requireId.

It is not recomended to use setPage() yourself. The apps router takes care of this.