在 mirajeJS 的帮助下,我们可以模拟路由,但是如果在 mirajeJS 中没有模拟这样的路由,是否可以重定向它并使用 axios 使用真实的服务器?
import {Server} from "miragejs";
new Server({
routes() {
this.namespace = "api/";
this.get("test/router", () => {
return [
{name: "Angy", surname: "T."},
{name: "Chris", surname: "B."},
{name: "Juliana", surname: "Crain"}
];
});
}
});
也就是我想实现如下行为,我湿了test/router请求,但是如果用户发出任何其他没有锁定在Miraje中的请求,那么就去到真实服务器,也就是使用真实请求