Middleware for ui5-server, making destinations
configured in SAP CF available for local development.
npm install ui5-middleware-cfdestination --save-dev
-
debug: true|false
verbose logging -
port:
<int>
port to run the underlyingapprouter
at locally -
xsappJson:
<string path>
path to the cf configuration filexs-app.json
-
destinations:
<Array of name/value pairs>
name: <string>
destination name, matching the one used in routes inxs-app.json
url: <string>
URI to the host
- Define the dependency in
$yourapp/package.json
:
"devDependencies": {
// ...
"ui5-middleware-cfdestination": "*"
// ...
},
"ui5": {
"dependencies": [
// ...
"ui5-middleware-cfdestination",
// ...
]
}
As the devDependencies are not recognized by the UI5 tooling, they need to be listed in the
ui5 > dependencies
array. In addition, once using theui5 > dependencies
array you need to list all UI5 tooling relevant dependencies.
- configure it in
$yourapp/ui5.yaml
:
server:
customMiddleware:
- name: ui5-middleware-cfdestination
afterMiddleware: compression
configuration:
authenticationMethod: "none" # "none" || "route", default: "none"
allowServices: false # allows sap services like SAP IoT to be used
debug: true
port: 1091
xsappJson: "xs-app.json"
destinations:
# check that the destination name (here: "backend") matches your router in xs-app.json
- name: "backend"
url: "https://services.odata.org/V4/(S(fdng4tbvlxgzpdtpfap2rqss))/TripPinServiceRW/"
- put the cf routing config file
xs-app.json
in the location of$yourapp
you specified above (xsappJson
)
The middleware wraps the @sap/approuter
npm module that is used in CF for serving UI5 applications, including proxying the configured destinations.
During development, the approuter
is started on a configurable port, running alongside the regular local webserver. When a call to a URL destination is detectet at $webserver/destination
, it is proxied to $approuter:$port
via request
.
Authentication on destinations is untested, but should work in theory (ha ha).
This work is dual-licensed under Apache 2.0 and the Derived Beer-ware License. The official license will be Apache 2.0 but finally you can choose between one of them if you use this work.
When you like this stuff, buy @vobu a beer or buy @pmuessig a coke when you see them.