koa 学习1

1.搭建环境;

npm init -f

2.出现错误

npm ERR!Windows_NT 6.1.7601
 
解决方法:
npm config set proxy null
npm install cnpm -g --registry=https://registry.npm.taobao.org
 
3.安装koa
cnpm i koa
 
4.下载node.exe 7.6.0 版本;
https://npm.taobao.org/mirrors/node/v7.6.0/win-x64/
 
5.形成app.js
const Koa = require('koa');
const app = new Koa();

app.use(async ctx => {
ctx.body = 'Hello World, New Demo';
});

app.listen(3001);

 

猜你喜欢

转载自www.cnblogs.com/maomingchao/p/koa.html
koa
今日推荐