Previously, I wrote about using JSON Web Tokens (JWT) as an alternative method of authentication using Go
. The post itself contains a basic explanation about JWT and some links for content. In this post, I want to cover pretty much the same things using Koa
, a new framework for Node.js.
Koa is mostly a middleware framework which uses generators (only available under the Harmony flag) to control the flow of requests. The reason I mention that it's a middleware framework is because it doesn't come with most of the things you would expect a framework to provide, such as routing, body parsers, etc. However, when it comes to middleware, Koa is baller.
First, install the following packages: