【重要】重构 并实现新的架构
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user