Episode 6 – Serving Content in Koajs with Jade
Koajs requires the node
'--harmony' flag which enables the ES6 feature Generators, the foundational building block in Koajs. There are many other features that are enabled when we use the
'--harmony' flag such as the new variable keyword
let. We'll use
let in place of
var through out the episode.
First we'll review the different types of responses that can be sent from Koajs and their default content types.
Then we will look at serving static content using the koa-static middleware.
Next we'll take a look at how to render dynamic content using co-views.
Co-views supports over 2 dozen templating engines by leveraging the node consolidate.js package.
I'll narrow down the list of templating engines to 3 unique and interesting choices:
We'll focus on the features and functionality of Jade in this episode, and we'll look at Swig and Marko in the next couple episodes.