标签 Go 下的文章

fetch 引发 blocked by CORS policy


起步

当使用 fetch 函数做跨域请求时,大概率会在浏览器 Console 中看到这样一个错误信息:Access to fetch at 'xxx' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.


Iris - 中间件


起步

Iris 的中间件设计秉承了 handler,或者,你就可以说它是 handler。这也是我极为喜欢 Iris 的一个原因,竭尽全力降低使用者的记忆负担——又少记一个函数签名。

中间件粗略在 Iris - 入门食用指南 里说过了。还不够,因为使用中间件需要牢记两个点:1. 中间件的作用域; 2. 中间件的执行顺序。


Iris - 子域


起步

子域一词语是我学 flask 首次接触到的,当时书上说了这么个功能,没有细讲,于是我长久不知道它是做啥的。再后来一路磕磕碰碰,像收集龙珠似的找到些子域的意义,今天就和着 Iris 的 Subdomain 来说说吧。