Episode 6 – Serving Content in Koajs with Jade

Author: James Moore

In this episode we will learn how to serve static and dynamic content in Koajs with a deep dive into Jade's features and functions.

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.

Source files can be found at: https://github.com/knowthen/Episode-6-Serving-Content-in-Koajs-with-Jade

Free Courses

Functional Concepts in JavaScript with Ramda

What's Ramda?

In this free mini-course, you'll learn about functional programming concepts like: map, filter, reduce, curry and function composition.

This is a great course for dipping your toes into Functional Programming.

Price:Free ($0)
Sign Up

Elm for Beginners

What's Elm, and why should I care?

It's an amazing language for writing web apps which have no runtime exceptions.

I'm pretty sure learning Elm will change the way you program And It's Free!

Price:Free ($0)
Sign Up