

It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML. HTML templater: A template library that's designed specifically for generating HTML.a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does). View engine: Also called a "template library" or "templater", ie.


For example, if you press return at each question to accept the defaults, the npm init process responds: About to write to ~/pugjs/package.json: Initialize a NodeJS development environment to automatically generate a package.json: npm initĪnswer the short questions to fit your project. Install curl to be able to install NodeJS from the NodeSource repository: $ sudo apt-get install curlĪdd the latest Active LTS NodeJS repository: $ curl -sL | sudo -E bash -Īnd finally, install NodeJS: $ sudo apt-get install nodejsĬheck if everything was installed properly: $ node -v & npm -vįirst, create the project root directory: $ cd ~ If not, install it using: $ sudo apt-get install build-essential

Follow our Ubuntu server update best practices. Have some knowledge with routing in ExpressJS Set up a non-root user with sudo privileges. Prerequisitesīefore starting, it is recommended that you: This tutorial uses the example server IP 192.0.2.123. Unlike standard HTML markup, PugJS allows HTML to be generated dynamically through data sent from the server to the view. Pug or PugJS is a template engine for NodeJS, which allows for server-side rendering of HTML.
