"View over the wire"
An app for taking data from Taitan (or similar) and rendering it according to templates, returns html to the user.
- We listen for e.g.
GET gloo.datasektionen.se/stuff/abc
- We
GET taitan.datasektionen.se/stuff/abc
, this is the data that will be rendered. - Determine which template we should use. First look for
/templates/gloo/stuff/abc.*
(where *are all our supported engine extensionsis the rendering engine extension specified in config.js). - If this template file exists, use it and continue.
- Else, try
/templates/gloo/stuff/_default.*
. - Else, try
/templates/gloo/_default.*
and so on, climbing until you reach the top of the templates folder. - Note: If the subdomain is not specified it is presumed to be
www
. - Render the data with the given template.
- Send back the rendered html to the user.
Before running, you have to create file config.js
and directory templates
. Feel free to copy config.example.js
and templates_example
.
The variables passed to the template engine are the same ones that Taitan sends, with no processing applied. So look there for documentation.
- Go to consolidatejs and make sure the engine is supported.
- Add the engine to
package.json
- Add the engine name in consolidate and extension to
config.js
- Do
npm install
to install the new engine. - Done.