💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
- 应用级中间件 ~~~ const koa = require('koa'); const router = require('koa-router')(); const app = new koa(); /* 匹配路由之前设置一个中间件 */ app.use(async (ctx,next)=>{ console.log(new Date()) // next向下匹配 await next() }) router.get('/user',async ctx=>{ ctx.body="user" }).get('/detail/',async ctx=>{ ctx.body = "detail" }) app.use(router.routes()).use(router.allowedMethods()); app.listen(8080) ~~~