Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Custom UI5 Server Middleware

The UI5 Server Extensibility enables you to enhance the functionality of the UI5 Server. You may want to handle requests differently. For example add various headers to a response or parse data of a POST request in a specific way. For this you can plug custom middleware implementations into the internal [express](https://expressjs.com/) server of the UI5 Server module.
The UI5 Server Extensibility enables you to enhance the functionality of the UI5 Server. You may want to handle requests differently. For example add various headers to a response or parse data of a POST request in a specific way. For this you can plug custom middleware implementations into the internal [Express 5](https://expressjs.com/) server of the UI5 Server module.

The UI5 community already created many custom middleware packages which you can integrate into your project. They are often prefixed by `ui5-middleware-` to make them easily searchable in the [npm registry](https://www.npmjs.com/search?q=ui5-middleware-).

Expand Down Expand Up @@ -32,7 +32,7 @@ In the above example the middleware `compression` is already included as a stand

There can be optional configuration parameters which are passed directly to the custom middleware implementation (see below).

An optional mountPath for which the middleware function is invoked can be provided. It will be passed to the `app.use` call (see [express API reference](https://expressjs.com/en/4x/api.html#app.use)).
An optional mountPath for which the middleware function is invoked can be provided. It will be passed to the `app.use` call (see [express API reference](https://expressjs.com/en/5x/api.html#app.use)).

### Execution order

Expand Down
10 changes: 10 additions & 0 deletions internal/documentation/docs/updates/migrate-v5.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Or update your global install via: `npm i --global @ui5/cli@next`

- **@ui5/cli: Option `--experimental-css-variables` has been removed**

- **@ui5/server: The internal Express server has been upgraded from Express 4 to Express 5**


## Node.js and npm Version Support

Expand Down Expand Up @@ -369,6 +371,14 @@ not run by default. The [`versionInfo`](../pages/Server.md#versioninfo) middlewa
The [`versionInfo`](../pages/Server.md#versioninfo) middleware now runs before [`serveResources`](../pages/Server.md#serveresources) rather than after it. Both match a request for `/resources/sap-ui-version.json`, but only `versionInfo` produces that file. Serving it first terminates the request directly and avoids `serveResources` triggering an unnecessary build of all dependencies while trying to locate the missing resource.
:::

## Express 5 Upgrade

The UI5 Server uses [Express](https://expressjs.com/) internally to serve your project. With UI5 CLI v5, this internal Express server has been upgraded from Express 4 to Express 5.

The standard middleware shipped with UI5 CLI is unaffected by this change. **However, if your project uses [custom server middleware](../pages/extensibility/CustomServerMiddleware.md), it might rely on Express APIs that changed with Express 5** (for example, changes to route path matching, `req.query` parsing, or removed methods).

Review your custom middleware against the [Express 5 migration guide](https://expressjs.com/en/guide/migrating-5/) and adjust it if necessary.

## Learn More

- [Project: Type `component`](../pages/Project#component)
Expand Down
Loading
Loading