Config 2: Mime Types

  1. config.js
    1. HTML Types
    2. JSON
    3. JSONP
    4. XML
  2. Authentication & Authorization
  3. URL Handling 
  4. Tasks

The mime tag in the URL indicates which type of content, HMTL, JSON or XML, should be returned to the visitor. It lets you easily present your website in different foreign languages too.

For example, if you visit
where e is defined to be English HTMl. Genelet will render the English page using the template Template/role/component/action.e.

You can define s to be Spanish HTML, so
will render the same page in Spanish using Template/role/component/action.s.

Furthermore, you may define tag j for JSON. In case of JSON (and XML), no template is needed. Genelet internally make JSON data structure.

There are 4 blocks in JSON:

  • data” : the main data structure, presented as an array of objects;
  • relationships” : the associated data structures, presented as an object;
  • incoming“: original requesting variables, presented as a hash map;
  • included“: any extra requesting variables such as those from cookie.

The mime type definition is in Chartag:

"Chartags" : {
    "Content_type":"text/html; charset=\"UTF-8\""
  "s" : {
    "Content_type":"text/html; charset=\"UTF-8\""
  "j" : {
    "Content_type":"application/json; charset=\"UTF-8\"",

where for JSON type, you need to define Challenge, Logged, Logout, Failed to indicate (a) this is a protect page, a login is needed; (b) a login is successful; (c) logged out; and (d) a login is failed. You can use different strings to indicate the status by changing the content in Chartag.