在 modelproxy-engine-fetch 的基础上扩展支持ssr
modelproxy-engine-fetch
使用fetch来调用接口的engine。
支持的设置
- settings.timeout 设置超时时间,默认为5s。
- settings.cache 设置缓存,key为fullPath+method,类型为Promise。没有持久化。只有GET才能缓存
demo
; ; reactEngine.init; /** * 请求真正的数据接口 * 判断http的状态码,如果不是200,直接抛出错误 * 判断数据的code字段,如果不是200,抛出错误 * 返回数据 */ reactEngine.use; ; ; proxy.addEngines;
Licence
MIT