初始化一个 koa 应用

  1. $ npm init -y
  2. $ npm install -S koa
  3. $ touch index.js
  1. // index.js
  2. const koa = require('koa')
  3. const app = new koa()
  4. app.use(async ctx => {
  5. ctx.body = 'Hello World!'
  6. })
  7. app.listen(3000)
// 启动
$ node index.js

image.png