1-1初始化 仓库

  1. npm init -y

1-2安装依赖

  1. npm i koa -S

1-3实现hello world

  1. const koa = require('koa')
  2. const app = new koa()
  3. app.use(async ctx=>{
  4. ctx.body="hello world"
  5. })
  6. app.listen(4000,()=>{
  7. console.log('服务器打开了');
  8. })