ui5-middleware-index

raw JSON →
3.1.3 verified Sat Apr 25 auth: no javascript

UI5 middleware for @ui5/cli that delivers a custom welcome/start page (e.g., index_peter.html) instead of a directory listing when the root path is requested. Version 3.1.3 is the latest stable, with monthly releases. Requires @ui5/cli@^3.0.0 and specVersion: "3.0" in ui5.yaml. Key differentiator: lightweight, community-maintained alternative to custom server configuration for SAP UI5 projects.

error Middleware 'ui5-middleware-index' is not supported by the current UI5 CLI version. Please update @ui5/cli to >=3.0.0.
cause Using @ui5/cli version below 3.0.0 with this middleware v3.
fix
npm install @ui5/cli@latest --save-dev
error Failed to load middleware: Cannot find module 'ui5-middleware-index'
cause Missing npm install or not listed in package.json devDependencies.
fix
npm install ui5-middleware-index --save-dev
error Configuration error: Unknown option 'index'. Use 'welcomeFile' instead.
cause Using deprecated 'index' option in ui5.yaml.
fix
Replace 'index' with 'welcomeFile' in the middleware configuration.
breaking Version 3.x requires @ui5/cli >=3.0.0 and specVersion: "3.0" in ui5.yaml. Older @ui5/cli versions are incompatible.
fix Update @ui5/cli to version >=3.0.0 and set specVersion: "3.0" in your ui5.yaml.
deprecated The 'index' configuration option is deprecated and will be removed in future versions.
fix Use 'welcomeFile' instead.
gotcha The middleware only triggers when requesting the root path '/' with a trailing slash. Omitting the trailing slash may not redirect.
fix Ensure URL ends with '/' or configure your browser to add trailing slash.
gotcha The middleware must be listed after 'compression' in ui5.yaml to work correctly.
fix Set 'afterMiddleware: compression' in the middleware configuration.
npm install ui5-middleware-index
yarn add ui5-middleware-index
pnpm add ui5-middleware-index

Installs middleware and configures ui5.yaml to serve a custom welcome file instead of directory listing.

// 1. Install
npm install ui5-middleware-index --save-dev

// 2. Add to ui5.yaml:
// server:
//   customMiddleware:
//   - name: ui5-middleware-index
//     afterMiddleware: compression
//     configuration:
//       welcomeFile: "index_peter.html"

// 3. Create index_peter.html in your app root
// 4. Run: ui5 serve
// Access http://localhost:8080/ -> serves index_peter.html