examples icon indicating copy to clipboard operation
examples copied to clipboard

Example Koa apps

Koa Examples

A repository containing small examples to illustrate the use of Koa for creating web applications and other HTTP servers.

Running tests

npm test
npm run lint

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

  • coko - A minimal convention over configuration framework/boilerplate for Koa 2.
  • kails - A Web App like Rails build with Koa v2, Webpack and Postgres
  • muffin - A content management system build on top of Koa v2
  • links - experimental content sharing and collaboration platform
  • component-crawler - crawl users and organizations for repositories with component.jsons
  • bigpipe - Facebook's BigPipe implementation in koa and component
  • webcam-mjpeg-stream - stream JPEG snapshots from your Mac
  • cnpmjs.org - Private npm registry and web for Enterprise, base on koa, MySQL and Simple Store Service
  • blog-mongo - the blog example from this repo, but using a MongoDb database, and tests
  • koa-rest - A simple app to demo REST API
  • koajs-rest-skeleton - A simple Koa REST Skeleton Application
  • koa-bookshelf - Koa example with CRUD, using MongoDB and Heroku comptability
  • todo - A todo example written in koa and react
  • koa-skeleton - A simple made-to-be-forked Koa app that uses Postgres and deploys to Heroku.
  • nodejs-docs-samples - An example Koa app and tutorial for deploying to Google App Engine
  • koa-passport-mongoose-graphql - Koa 2 starterkit using mongoose, graphql setup, and authentication with passport
  • hacknical - A website for github user to make a better resume, based on Koa v2, redis and mongoose.
  • koa-vue-notes-api - A fleshed-out SPA using Koa 2.3 on the backend and Vue 2.4 on the frontend. Includes fully featured user-authentication components, CRUD actions for the user's notes, and async/await.
  • koa-typescript-node - Template for building nodejs and typescript services. Features: MySql, Migrations, Docker, Unit & Integration Tests, JWT authentication, authorization, graceful shutdown, Prettier.

Boilerplates

Yeoman Generators

  • koa-rest - RESTful API scaffolder with subgenerator
  • koa - Web Application scaffolder
  • k - Web Application scaffolder with Chinese README

Articles