koa2解決跨域請求和options請求

跨域 使用koa-cors解決跨域問題 添加一箇中間件 // 跨域設置 // app.use(convert(cors)); app.use(async (ctx, next) => { ctx.set('Access-Control-Allow-Origin', '*'); await next(); }); 解決options請求 因爲作了跨域,因此前端用post請求後臺接口的時候
相關文章
相關標籤/搜索