Github.com/aerchen/koa…

The usage is as follows.

Const Koa = require(' Koa ') const c2k = require('koa-connect') const app = new Koa() Use (c2K (connectMiddlware)) // Use the anonymous module app.use((CTX, next) => { console.log('It will continue on to here') }) app.listen(3000)Copy the code

Matters needing attention:

It is highly recommended to use a Koa-specific middleware instead of trying to convert an Express version when they’re available. There is a non-trivial difference in the Koa and Express designs and you will inevitably run into some issues. This module is a workaround for the specific cases where the differences can be ignored. Additionally, it also enables library authors to write 1 version of their HTTP middleware.

Google Translate:

It is strongly recommended to use KOA-specific middleware rather than trying to convert the available versions of Express. There is a small difference between Koa and Express design, and you will inevitably encounter some problems. This module is a solution for specific cases where differences can be ignored. In addition, it allows library authors to write a version of their HTTP middleware.