1.升级node 到 11
2.npm install koa 安装koa
3.编写koa hello 代码 koaTest.js
var koa = require('koa');
var app = koa();
app.use(function *() {
this.body = 'Hello world';
});
var server = app.listen(3000, function() {
console.log('Koa is listening to http://localhost:3000');
});
4.执行 node --harmony koaTest (--harmony 是启用ECMAScript 6 )
5.访问http://localhost:3000/admin
页面显示 Hello
参考文档:http://koajs.cn/