September 2014
Intermediate to advanced
316 pages
7h 6m
English
We now have a working site that has routes and middleware, but we are missing one import thing—HTML. Our requests come back with a Content-Type of text/html. Although res.send() adds this header for us, it is just text. It is missing a document type, head, and body, which is where another feature of Express comes in: templates.
We will use Embedded JavaScript (EJS) as our view template engine. I must notify you here that many tutorials, and even the Express command-line utility, default the view engine to Jade. I have used a few other template systems, which are not limited to PHP (which by itself is a kind of template system), Python's Django template, and Microsoft's Razor engine in MVC, to name a few. Luckily, EJS ...