Integrate with Backend API

In our framework, models are specified in a JSON file. We follow the naming convention to correlate files of the “view” and “model”. For example, “tasks.html” which is “view” of a task list, has corresponding “tasks.json” for the model specification. In fact, “tasks.json” is also used for other meta-data of the “view”. In the detailed document, we discuss all meta-data of a view. The values inside the JSON file can be templatized using Mustache template-specification. The following shows an example JSON file for the model and API specification.

{
  "name" : "tasks",
  "type" : "dataTable",
  "apiSpec" : {
    "serviceUrl" : "/ds/page/Task",
    "body" : {
      "size" : 100,
      "start" : 1,
      "where" : "status={{statusFilter.value}}"
    },
    "method" : "post"
  },
  "actionSpecs" : [
    {
      "name" : "title",
      "query" : "id={{id}}",
      "target" : "TaskDetail",
      "type" : "viewAbsoluteNav"
    }
  ]
}

You will notice that actions can also be specified in a declarative way. The above shows an action, which means, when the user clicks on the “title”, navigate to “TaskDetail” view.