Koa2 Examples
Migrate from https://github.com/koajs/examples
A repository containing small examples to illustrate the use of Koa2 for creating web applications and other HTTP servers.
Installation
Koa2 examples requires node v7.6.0 or higher for ES2015 and async function support.
npm install
Usage
cd 404/
node app.js
Running tests
make
Included Examples
- 404 - 404 handling
- base-auth - middleware base auth example
- blog - multi-route & view rendering
- body-parsing - request body parsing
- compose - compose middlewares example
- conditional-middleware - shows how middleware may be conditionally applied
- cookies - cookie usage example
- csrf - middleware csrf example
- errors - error handling & propagation
- flash-messages - flash example
- hello-world - hello world application
- multipart - multipart example downloading files using co-busboy
- negotiation - negotiation usage example
- stream-file - simple file streaming
- stream-objects - objects streaming
- stream-server-side-events - server side events streaming
- stream-view - view streaming
- templates - simple view rendering
- upload - multi-file uploading
- vhost - virtual host example
Example Repositories
Boilerplates
- koa2-boilerplate - A minimal boilerplate of koa v2 development