koa2 hello world 示例

版权声明:程序员小鱼 https://blog.csdn.net/u012664888/article/details/77516078

根据错误提示,koa2需要使用 new 示例的demo代码改为:

var koa = require('koa2');
var app = new koa();

app.use(function *(){
  this.body = 'Hello World';
});

app.listen(3000);

猜你喜欢

转载自blog.csdn.net/u012664888/article/details/77516078