I\'m currently following the UI5 tutorial and am stuck on step 27: Mock Server Configuration.
The problem is the rootUri
configuration of the mock server. I
There are some rules to watch out for when it comes to defining the rootUri
for mock server.
The rootUri
"/"
)It is mentioned in the step 27:
(The
rootUri
) matches the URL of our data source in the descriptor file.
As well as in the topic Mock Server: Frequently Asked Questions:
The root URI has to be relative and requires a trailing '/'. It also needs to match the URI set in OData/JSON models or simple XHR calls in order for the mock server to intercept them.
So it doesn't matter how your rootUri
is defined as long as it fulfills those three requirements mentioned above. That's why some arbitrary URIs like rootUri: "/"
works as well but only if the uri
in the dataSource is the same.
In your case, changing the rootUri
value like this below should make the mock server running:
var oMockServer = new MockServer({
rootUri: "/destinations/northwind/V2/Northwind/Northwind.svc/"
});
And in your app descriptor (manifest.json) respectively..:
"dataSources": {
"invoiceRemote": {
"uri": "/destinations/northwind/V2/Northwind/Northwind.svc/",
"type": "OData",
"settings": {
"odataVersion": "2.0"
}
}
}
To make the path work in a non-MockServer scenario, you'll need to register a corresponding destination in SAP Cloud Platform and edit neo-app.json in your project accordingly.
No need to change the application code.