Skip to main content

Views

Views can be implemented a few different ways. One could serve the index file for a single-page-application as the last route on the express context.

However, one could also use templates and return server rendered HTML to the client.

Funkallero offers a base service for this purpose making use of Handlebars as template engine. This can of course be extended or overwritten completely.

Example App​

The example app uses the handlebar template service, it can be broken down as such:

  • Express Service
    • serve public folder containing js, css etc.
    • Code
  • Handlebar Templates
    • page and partial templates
    • Code
  • Template Service
    • register templates (and use them with excellent type-safety)
    • Code
  • Application Layer
    • connect actions to templates
    • Code
  • Controller Layer
    • connect routes to actions
    • Code

Take a look at the dev script here to see how one could run it all with hot-reloading while developing.