Skip to content
使用不到40行代码实现一个 koa
JavaScript
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore init Mar 14, 2020
Readme.md init Mar 14, 2020
index.js Add error handle Mar 14, 2020
package-lock.json init Mar 14, 2020
package.json init Mar 14, 2020

Readme.md

Koa Mini

使用 40 行代码实现一个最简化版本的 Koa

Example

测试用例如下:

// Example
const app = new Application()

app.use(async (ctx, next) => {
  console.log('Middleware 1 Start')
  await next()
  console.log('Middleware 1 End')
})

app.use(async (ctx, next) => {
  console.log('Middleware 2 Start')
  await next()
  console.log('Middleware 2 End')
})

app.listen(7000)

// console.log
// Middleware 1 Start
// Middleware 2 Start
// Middleware 2 End
// Middleware 1 End
You can’t perform that action at this time.