From d3e050eec060ff5b9bd263f6feb54ab10cc07252 Mon Sep 17 00:00:00 2001 From: yoga Date: Sun, 31 Jul 2022 03:13:48 +0800 Subject: [PATCH] =?UTF-8?q?add(src):=20=E5=A2=9E=E5=8A=A0user=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E8=B7=AF=E7=94=B1=E6=A0=B7=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controller/user.ts | 17 +++++++---------- src/routers/user.ts | 5 +++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/controller/user.ts b/src/controller/user.ts index 39a1016..5243bb5 100644 --- a/src/controller/user.ts +++ b/src/controller/user.ts @@ -1,13 +1,10 @@ -import d from "../models/user"; -import Koa from "koa"; -// class UserController { - export async function register(ctx: any, next: any) { - ctx.json({ code: 0, message: "success" }); - } +export async function register(ctx: any, next: any) { + ctx.body = { code: 0, message: "success" }; +} + +export async function getUserList(ctx: any, next: any) { + ctx.body = { code: 0, message: "success" }; +} - export function getUserList(ctx: any, next: any) { - ctx.json('{ "code": 0, "message": "success" }') - } -// } // export default new UserController(); diff --git a/src/routers/user.ts b/src/routers/user.ts index 42a9161..215a167 100644 --- a/src/routers/user.ts +++ b/src/routers/user.ts @@ -1,6 +1,7 @@ -import { getUserList } from "../controller/user"; +import { getUserList, register } from "../controller/user"; import Router from "koa-router"; export const router = new Router({ prefix: "/user" }); -router.get("/list", getUserList); +router.post("/list", getUserList); +router.post("/register", register);