parent
caa4976594
commit
d08ee72e1d
18
koa-%E5%9F%BA%E7%A1%80.md
Normal file
18
koa-%E5%9F%BA%E7%A1%80.md
Normal file
@ -0,0 +1,18 @@
|
||||
### 创建
|
||||
```
|
||||
//创建koa对象
|
||||
const Koa = require('koa');
|
||||
const app = new Koa();
|
||||
//监听3000 端口
|
||||
app.listen(3000);
|
||||
```
|
||||
### 请求
|
||||
在controllers创建js文件 自动引入
|
||||
```
|
||||
var getlabel = async (ctx, next) => {
|
||||
ctx.body = '返回信息'
|
||||
}
|
||||
module.exports = {
|
||||
'GET /getlabel':getlabel
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue
Block a user