From d08ee72e1d5fab1cfaae767b5452f9235c966583 Mon Sep 17 00:00:00 2001 From: pplokijuhyg <1162963624@qq.com> Date: Tue, 18 Feb 2020 12:33:17 +0800 Subject: [PATCH] --- koa-%E5%9F%BA%E7%A1%80.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 koa-%E5%9F%BA%E7%A1%80.md diff --git a/koa-%E5%9F%BA%E7%A1%80.md b/koa-%E5%9F%BA%E7%A1%80.md new file mode 100644 index 0000000..9ff1b35 --- /dev/null +++ b/koa-%E5%9F%BA%E7%A1%80.md @@ -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 +} +```