【重要】重构 并实现新的架构

This commit is contained in:
编码猿
2025-09-30 10:00:10 +08:00
parent 04754a1f77
commit a3ba6c2944
31 changed files with 459 additions and 302 deletions

View File

@@ -5,9 +5,9 @@ export const app = new App<State>();
app.use(cors({
origin: "*",
allowHeaders: [ "*" ],
allowMethods: [ "POST", "GET", "OPTIONS" ],
exposeHeaders: [ "Content-Length", "X-Kuma-Revision" ],
allowHeaders: ["*"],
allowMethods: ["POST", "GET", "OPTIONS"],
exposeHeaders: ["Content-Length", "X-Kuma-Revision"],
maxAge: 600,
credentials: true,
}))
@@ -74,8 +74,17 @@ app.get("/api/productsInfo", (req: Request, ctx: { params: { id: number; }; }) =
return new Response(Res(result));
});
// test 测试接口
app.get("/nacos", (ctx: { params: { name: any; }; }) => {
console.log("test 测试接口 被运行");
return new Response(JSON.stringify({
title: "test测试接口"
}));
});
const exampleLoggerMiddleware = define.middleware((ctx: { req: { method: any; url: any; }; next: () => any; }) => {
console.log(`${ ctx.req.method } ${ ctx.req.url }`);
console.log(`${ctx.req.method} ${ctx.req.url}`);
return ctx.next();
});