add(src): 增加user业务路由样例

This commit is contained in:
yoga 2022-07-31 03:13:48 +08:00
parent c350edf538
commit d3e050eec0
2 changed files with 10 additions and 12 deletions

View File

@ -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" });
ctx.body = { code: 0, message: "success" };
}
export function getUserList(ctx: any, next: any) {
ctx.json('{ "code": 0, "message": "success" }')
export async function getUserList(ctx: any, next: any) {
ctx.body = { code: 0, message: "success" };
}
// }
// export default new UserController();

View File

@ -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);