Koa: A next-gen Node.js web framework
Koa is a next-generation
web framework for Node.js, designed by the team behind Express. It aims to be a more expressive and more robust foundation for web applications and APIs, while also being smaller than similar solutions.
Expressive middleware for node.js using generators
Expressive middleware for node.js using generators via co to make web applications and APIs more enjoyable to write. Koa's middleware flow in a stack-like manner allowing you to perform actions downstream, then filter and manipulate the response upstream. Koa's use of generators also greatly increases the readability and robustness of your application.
Only methods that are common to nearly all HTTP servers are integrated directly into Koa's small ~400 SLOC codebase. This includes things like content-negotiation, normalization of node inconsistencies, redirection, and a few others.
No middleware are bundled with koa. If you prefer to only define a single dependency for common middleware, much like Connect, you may use koa-common.
Installation
$ npm install koa
To use Koa you must be running node 0.11.9 or higher for generator support, and must run node(1) with the --harmony
flag. If you don't like typing this, add an alias to your shell profile:
alias node='node --harmony'
Another option, if you would like to use koa with node 0.10.x (the current stable branch), or are tired of typing the --harmony
flag, is to use gnode
to spawn your node instance. However note that performance degrades quickly compared to 0.11.x.
Community