Topic "Create a Northwind Destination": Proper neo-app.json Setting Missing
The topic Create a Northwind Destination ends with:
With this configuration you can use the destination for any app inside SAP Web IDE. Whenever an app calls a (local) service beginning with
/destinations/northwind/*, the created destination becomes active as a simple proxy. This helps to prevent any possible issues related to the same-origin policy of browsers.
And that's it.
It's missing a link between neo-app.json and the destination created in SCP, leaving the reader out in the cold. If the prefix "/destinations/northwind/" is not added to the "routes" inside the neo-app.json, the app won't be able to fetch any data from the service. That information, however, is not mentioned in the topic.
There is the previous topic Create neo-app.json Project Configuration File, but that doesn't include the destination created in SCP but only the basic route to get the UI5 resources.
What is the expected result?
The topic Create a Northwind Destination guides the reader into adding the corresponding route to the neo-app.json appropriately, just like in the topic Request Fails Due to Same-Origin Policy (Cross-Origin Resource Sharing - CORS):
neo-app.json
...
{ "routes": [ { "path": "/destinations/northwind", "target": { "type": "destination", "name": "northwind" }, "description": "Northwind OData Service" } ] }...
manifest.json
"sap.app": { "dataSources": { "invoiceRemote": { "uri": "/destinations/northwind/V2/Northwind/Northwind.svc/", "type": "OData", "settings": { "odataVersion": "2.0" } } } },
Or at least a link to "the next step", where adding the route is mentioned, would be great.
Hello @boghyon, Thank you for sharing this finding. I've created an internal incident 1870493370. The status of the issue will be updated here in GitHub. Regards, Georgi
Thanks, Georgi, good point. I'll take a look and consider your improvement suggestions. Regards, Annette
Ticket was updated and the documentation improved, please check.
@AnnFr Thanks for the update! I can see that the neo-app.json settings are added now. It would be better if the manifest.json setting is also added as an example.
"sap.app": {
"dataSources": {
"invoiceRemote": {
"uri": "/destinations/northwind/V2/Northwind/Northwind.svc/",
"type": "OData",
"settings": {
"odataVersion": "2.0"
}
}
}
},
The topic says ..
Whenever an app calls a (local) service beginning with
/destinations/northwind/*
..but a concrete example would provide better understanding.
Is this issue still being tracked? People do read documentation but are confused because of the incomplete guide (See e.g. this question). It's still missing:
- proper route in neo-app.json in the code snippet
- manifest.json sample as in https://github.com/SAP/openui5/issues/2307#issuecomment-448953018
https://openui5nightly.hana.ondemand.com/#/topic/3a16c7a2f1e944deb000db49e5ece6be
From Slack:
Hi guys. In SAPUI5 SDK page, in the page for topic 'create northwind destination', the code sample doesn't show the new code regarding the explanation above the code sample box.
Hello @boghyon,
i made sure that those code blocks are now appearing in the documentation according to your feedback and are marked properly using our highlighting syntax of the demo kit.
It will be first visible here on openui5nighly, once our UA colleagues approved the change: https://openui5nightly.hana.ondemand.com/#/topic/3a16c7a2f1e944deb000db49e5ece6be
here is a sneak preview for your convenience :-)
neo-app.json
With this configuration you can use the destination for any app inside SAP Web IDE. Whenever an app calls a (local) service beginning with /destinations/northwind/*, the created destination becomes active as a simple proxy. This helps to prevent any possible issues related to the same-origin policy of browsers. For this, you need to add another route to the neo-app.json:
{
"welcomeFile": "index.html",
"routes": [
{
"path": "/resources",
"target": {
"type": "service",
"name": "sapui5",
"version": "snapshot",
"entryPath": "/resources"
},
"description": "SAPUI5 Resources"
},
{
"path": "/test-resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/test-resources"
},
"description": "SAPUI5 Test Resources"
}*HIGHLIGHT START*,
{
"path": "/destinations/northwind",
"target": {
"type": "destination",
"name": "northwind"
},
"description": "Northwind OData Service"
}*HIGHLIGHT END*
]
}
webapp/manifest.json
In the app descriptor, the service URL is then defined relative to the destination path specified above:
...
"sap.app": {
"dataSources": {
"": {
"uri": "*HIGHLIGHT START*/destinations/northwind/V2/Northwind/Northwind.svc/*HIGHLIGHT END*",
"type": "OData",
"settings": {
"odataVersion": "2.0"
}
}
}
}
...
Thanks again for your patience and for reporting all the details in this issue - it is appreciated!
All the best, Michael