Mirage does match defined routes when the backend calls are performed through the root url (localhost:4200/), but when we perform a backend call on a sub page, e.a.: localhost:4200/process, it will not work. When debugging the mirage code it will try to match by prefixing the url to be matched with "process". So in case BE call is "api/portal/affiliates/", it will try to match "process/api/portal/affiliates/" which fail as there doesn't exists a matching path. Any idea how to solve this.
We are using mirage.js in angular 9. The roue mirage.js config:
routes() {
this.passthrough();
this.namespace = '/api/portal;
this.get('affiliates', (schema, request) => {
return schema.db.affiliates;
})
}