Justin-lu
Justin-lu
随着前端越来越火,越来越多的人推崇前后端分离,后端只提供API,前端只负责消费API。这样我们就能更加专注自己的事情了,比如前端可以使用任何想要的工具(Webpack、Gulp等等),后端也不用因为集成前端的代码而苦逼加班了。这里不讨论前后端分离的必要性,更多可参考 - [淘宝前后端分离实践](http://2014.jsconf.cn/slides/herman-taobaoweb/#/96) - [淘宝前后端分离系列文章](http://frontenddev.org/column/taobao-full-stack-development/) - [我们为什么要尝试前后端分离](http://mp.weixin.qq.com/s?__biz=MzAwNjI5MTYyMw==&mid=2651493177&idx=1&sn=730545f530e7d6506b884ab46462169a&scene=7#wechat_redirect) 这里主要分享前后端分离后,如何解决跨域问题 ## 服务端 ### Rails 作为一个`Rails`程序员,首先分享一下在`Rails`里面的解决方案, 大家可以使用一个[rack-cors](https://github.com/cyu/rack-cors) 中间件,并作以下配置: ``` ruby #config/application.rb config.middleware.insert_before 0, "Rack::Cors", :debug => true, :logger => (-> { Rails.logger })...
# [React Redux 实战经验](http://jianggaowang.com/slides/138-react-redux-zui-jia-shi-jian)                   ![Uploading file-page19.jpg…]()     ![Uploading file-page24.jpg…]()...
使用 static-cache 作为静态文件托管,使用过程中,概率出现以下报错 ```js 2021-12-30 10:14:09,663 ERROR 247 [-/-/172.16.224.25/64407ebb16408304496621596d00f7/2ms GET /public/common/bi.jpeg] ### onerror handle { TypeError: Cannot read property 'getTime' of undefined at /xxxxl/node_modules/[email protected]@koa-static-cache/index.js:86:48 status: 500 } 2021-12-30 10:15:17,903 ERROR...