Registry / devops / ui5-middleware-approuter

ui5-middleware-approuter

JSON →
library3.9.0jsnpmunverified

Middleware for ui5-server that enables local development against SAP Cloud Foundry or XS Advanced destinations via the @sap/approuter. Version 3.9.0 requires @ui5/cli@3.0.0+ (specVersion 3.0). Community-maintained under the ui5-ecosystem-showcase organization. Provides local proxy to backend services defined in xs-app.json, with support for BTP services, authentication, content rewriting, and custom extensions. Alternatives include direct http-proxy-middleware usage, but this package integrates seamlessly with the UI5 tooling lifecycle.

npm install ui5-middleware-approuter
INSTALL
IMPORT
SIG · UI5-MIDDLEWARE-APP
U
ui5-middleware-approuter
devopsjavascriptv3.9.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
module.exports = function() { ... }
export default function()
UI5 middleware uses CommonJS module.exports; ESM exports are not supported by ui5-server.
N/A
Add to ui5.yaml under middleware section with name 'approuter'
Adding as a devDependency only and not configuring ui5.yaml.
The package is a ui5-server middleware extension; no JS import needed. Configuration is via ui5.yaml file.

Install middleware, configure ui5.yaml with a destination proxy, create minimal xs-app.json, and start ui5 server.

npm install ui5-middleware-approuter --save-dev mkdir -p myapp/webapp cat > myapp/ui5.yaml <<EOF specVersion: "3.0" metadata: name: myapp type: application resources: configuration: paths: webapp: webapp server: customMiddleware: - name: approuter afterMiddleware: compression configuration: port: 5000 xsappJson: "./xs-app.json" destinations: - name: backend url: "https://my-backend.example.com" EOF cat > myapp/xs-app.json <<EOF { "routes": [{ "source": "^/backend/(.*)$", "target": "$1", "destination": "backend" }] } EOF cd myapp && npx ui5 serve
Debug
Known issues
breakingVersion 3.x requires UI5 CLI v3 with specVersion 3.0
fix
Update @ui5/cli to 3.0.0+ and set specVersion: '3.0' in ui5.yaml
affects: >=3.0.0
gotchaDestinations defined in .env file must be a single JSON string; not parsed automatically as multiple env vars
fix
Use xsapp_dest = '[{"name":"...","url":"..."}]'
affects: >=0.0.0
gotchaRegular expression in xs-app.json must match pattern like '^/backend/(.*)$' - leading ^ and trailing $ required
fix
Use '^/backend/(.*)$' instead of '/backend/'
affects: >=0.0.0
gotchaExtension modules with more than 3 arguments are not called for regular extensions; only for approuter extensions
fix
Ensure extension handler has exactly 3 parameters (req, res, next) unless using parameters map
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: Cannot read property 'destinations' of undefined
ui5.yaml missing or incorrectly configured middleware section
fix
Add server.customMiddleware configuration with approuter settings
Error: UI5 CLI version mismatch - expected specVersion 3.0
Using UI5 CLI v2 with package v3
fix
Install @ui5/cli@3 and update specVersion in ui5.yaml to '3.0'
Error: Could not find xs-app.json at path ./xs-app.json
xs-app.json file missing or wrong path
fix
Create xs-app.json in project root or set xsappJson option in ui5.yaml
Upgrade
Version history
3.9.0latest on npm
Audit
Dependencies
@sap/approuterrequiredCore proxy runtime from SAP
http-proxy-middlewarerequiredHandles actual HTTP proxying
@ui5/serverrequiredUI5 server extension interface
Agent activity
52 hits · last 30 days
node
46
OpenAI (training)
1
Resources
ui5-middleware-approuter — npm install ui5-middleware-approuter · libregistry