koa-mysql(一)
先来一个hello,world
目录结构

新建package.json
mkdir koa2s cd koa2s npm init
新建index.js
const koa = require('koa');
const app = new koa();
app.listen(3000);
console.log(`app start at localhost:3000`);安装依赖,执行
cnpm install koa --save node index.js

新建数据,返回hello,world
修改index.js
const koa = require('koa');
const app = new koa();
app.use(async(ctx, next) => {
ctx.response.body = "<h1>hello,world</h1>"
})
app.listen(3000);
console.log(`app start at localhost:3000`);重新运行
node index.js

相关推荐
往后余生 2020-09-17
yanyongtao 2020-11-02
lzccheng 2020-09-06
webgm 2020-08-16
lert0 2020-08-16
80447704 2020-06-09
LorenLiu 2020-06-07
无缘公子 2020-02-02
LorenLiu 2020-01-31
LorenLiu 2020-01-30
80447704 2020-01-30
苏莉koa 2020-01-29
Qimingweikun 2020-01-28
80447704 2020-01-02
byourb 2020-01-04
80447704 2019-12-24