@sap/ux-ui5-fe-mockserver-middleware

SAP Fiori tools - UI5 middleware for the Fiori elements mock server

Usage no npm install needed!

<script type="module">
  import sapUxUi5FeMockserverMiddleware from 'https://cdn.skypack.dev/@sap/ux-ui5-fe-mockserver-middleware';
</script>

README

@sap/ux-ui5-fe-mockserver-middleware

Features

The SAP Fiori - UI5 middleware for the Fiori elements mock server is a middleware extension for the UI5 Tooling. As an alternative to proxying OData requests to a live backend, it supports loading mock data for OData v2/v4 requests for supported Fiori elements templates. As the mock server runs locally without requiring a network connection to a backend system, it is useful for development and test scenarios.

Installation

  1. Get Node.js
  2. Install the mockserver middleware
    npm install @sap/ux-ui5-fe-mockserver-middleware
    

Usage

In order to use the mock server, the npm module @sap/ux-ui5-fe-mockserver-middleware needs to be added as devDependency and ui5.dependencies to package.json, and a valid ui5.yaml configuration needs to be provided. Entries in package.json

[..]

"devDependencies": {
    "@sap/ux-ui5-fe-mockserver-middleware": "^1"
},
"ui5": {
    "dependencies": [
        "@sap/ux-ui5-fe-mockserver-middleware"
    ]
}

[..]

Example for a yaml configuration file


specVersion: '2.0'
metadata:
    name: <NAME>
type: application
server:
    customMiddleware:
        - name: sap-fe-mockserver
          mountPath: /
          afterMiddleware: compression
          configuration:
            annotations:
              localPath: './webapp/annotations/annotation.xml'
              urlPath: '/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Annotations*'
            service:
              urlBasePath: '/sap/opu/odata/sap'
              name: '<SERVICE_NAME>'
              metadataXmlPath: './webapp/localService/metadata.xml'
              mockdataRootPath: './webapp/localService/data'

Sample application

See the usage in demo apps SAP Fiori sample apps

Support

Join the SAP Fiori tools Community. Ask Questions, Read the Latest Blogs, Explore Content. Please assign tag: SAP Fiori tools

To log an issue with SAP Fiori tools, please see Contact SAP Support.