Response Arguments

Below is a list of arguments that can be accessed in controller and view responses.

The response arguments are almost the same for controller functions and template views, with one difference: views use the data argument instead of request. Keep that in mind when reviewing the list below:

props

This is the object data passed to your template file. It contains information that helps to render the view with dynamic data

This argument is only accessible by template views.

http

This argument provides access to request-related information. For example, consider a request with the URI path /product/72/chesterfield:

This argument provides access to request-related information and is used primarily within controller functions.

This argument is only accessible by controller functions

{
    "verb": "GET",
    "status": 200,
    "path": ["product", "72", "chesterfield"],
    "vars": {
        "page": "product",
        "id": "72",
        "slug": "chesterfield"
    },
    "form": {},
    "request": {
        "get": "URLSearchParams",
        "post": {}
    }
    "response": {} // If returns a ajax response
}
  • verb: The HTTP method (GET or POST).

  • status: The HTTP status code (200, 404, or 405).

  • path: The URI path as an array.

  • vars: An object mapping path segments to keys.

  • form: Captures submitted DOM form elements.

  • request.get: An instance of URLSearchParams for GET requests.

  • request.post: An object for POST requests.

  • response: Will propagate if a possible fetch (Ajax) response.

container

The container can be used to communicate with your template and the outside. You can create your own or access the frameworks functions like bellow.

const dispath = container.get("dispatch");
dispath.navigateTo("#about");

helper

Your own possible helper libraries, objects, and functions you passed in the configuration.

context

Access the Stratox builder context library (you can manage without, only for advanced users; more on this later on).

Last updated