Summary
In this chapter, I demonstrated how server-side and client-side templates work, and how they can be used to generate HTML content. The following information was also covered:
- Templates are a mix of static content with placeholders for data values.
- When a template is rendered, the result is an HTML document or fragment that reflects the current state of the application.
- Templates can be rendered by Node.js, as server-side templates, or by JavaScript running in the browser, as client-side templates.
- Client-side templates are usually compiled into JavaScript functions so they can be easily rendered by the browser.
- There are many good open-source template packages available, all of which offer similar features, but use different template file formats.
In the next chapter, I will explain how you can use HTML forms to receive data from the user, and how to validate the data when it is received.