SAP Fiori Tools 里 proxy 中间件的使用场景介绍

简介: SAP Fiori Tools 里 proxy 中间件的使用场景介绍

使用 proxy 中间件可以让开发人员通过配置的方式连接不同的后台系统,或者是切换不同的 SAP UI5 版本。

下面是一个典型的 ui5.yaml 里的 proxy 配置文件的例子:

- name: fiori-tools-proxy
  afterMiddleware: compression
  configuration:
    backend:
    - path: /sap
      url: https://my.backend.com:1234

这个配置的语义是,该 SAP UI5 应用启动之后,凡是发送到 /sapXXX 路径的 OData 请求,都会被自动转发到 url 指定的后台服务器去。

为了使上述 ui5.yaml 生效,需要使用命令行 npx fiori run 启动本地 SAP UI5 应用。


如果需要通过 destination 连接到后台系统(这是 SAP UI5 应用部署到 SAP BTP 平台 CloudFoundry 环境的常见需求),只需要在 ui5.yaml 里增添 Destination 字段的维护:

- name: fiori-tools-proxy
  afterMiddleware: compression
  configuration:
    backend:
    - path: /sap
      url: https://my.backend.com:1234
      destination: my_backend

连接多个后台系统的配置语法:

- name: fiori-tools-proxy
  afterMiddleware: compression
  configuration:
    backend:
    - path: /northwind
      url: https://my.backend_2.com:1234
    - path: /sap
      url: https://my.backend.com:1234

连接 SAP API Hub 的语法:

- name: fiori-tools-proxy
  afterMiddleware: compression
  configuration:
    backend:
    - path: /s4hanacloud
      url: https://api.sap.com
      apiHub: true

相应的,如果是连接 SAP BTP ABAP 编程环境,加上如下的键值对:

scp: true

可以通过配置的方式,指定任意的 SAP UI5 版本号:

- name: fiori-tools-proxy
  afterMiddleware: compression
  configuration:
    ui5:
      path:
      - /resources
      - /test-resources
      url: https://sapui5.hana.ondemand.com
      version: 1.78.0

让 SAP UI5 使用本地库文件的做法:

server:
  customMiddleware:
  - name: fiori-tools-servestatic
    afterMiddleware: compression
    configuration:
      paths:
        - path: /resources
          src: "Path/To/SAPUI5-SDK"
        - path: /test-resources
          src: "Path/To/SAPUI5-SDK"

如果想加载静态图片:

server:
  customMiddleware:
  - name: fiori-tools-servestatic
    afterMiddleware: compression
    configuration:
      paths:
        - path: /images
          src: "Path/To/images"
        - path: /libs
          src: "Path/To/libs"

fiori-tools-servestatic 是一个 Node.js 包,用于为 SAP Fiori 应用程序提供静态文件服务。SAP Fiori 是一组基于 SAPUI5 的应用程序,用于简化和优化用户与 SAP 解决方案的交互。这些应用程序的前端资源(如 JavaScript、HTML 和 CSS 文件)通常需要通过 HTTP 服务器进行服务。


fiori-tools-servestatic 包的作用是在本地开发环境中为这些静态资源提供一个简单的 HTTP 服务器,使开发人员能够运行和测试他们的 Fiori 应用程序。这个包可以作为一个单独的命令行工具使用,也可以与其他 Fiori 工具一起使用,例如 @sap-ux/fiori-tools-proxy,它提供了一个代理服务器来处理与后端系统的通信。


相关文章
|
27天前
|
数据库 API
启用SAP Fiori之前的一些注意事项
启用SAP Fiori之前的一些注意事项
10 0
|
3月前
|
IDE JavaScript 开发工具
什么是 SAP Fiori tools 的 environment check 功能
什么是 SAP Fiori tools 的 environment check 功能
28 0
|
2月前
SAP UI5 Link 控件的使用方法介绍 - 后续学习 Fiori Elements Smart Link 的基础试读版
SAP UI5 Link 控件的使用方法介绍 - 后续学习 Fiori Elements Smart Link 的基础试读版
15 0
|
2月前
|
UED
什么是 SAP Fiori 的 Technical Catalog 和 Business Catalog
什么是 SAP Fiori 的 Technical Catalog 和 Business Catalog
38 0
|
2月前
|
前端开发 UED
SAP Fiori 到底指什么
SAP Fiori 到底指什么
43 0
|
2月前
|
XML 前端开发 JavaScript
SAP Fiori Launchpad Custom Fields tile 里的 ABAP 语法高亮显示
SAP Fiori Launchpad Custom Fields tile 里的 ABAP 语法高亮显示
14 0
|
3月前
|
XML 存储 JavaScript
关于 SAP Fiori Elements List Report 里的 TableCell.fragment.xml 头部声明
关于 SAP Fiori Elements List Report 里的 TableCell.fragment.xml 头部声明
22 0
|
3月前
SAP Fiori Elements 应用里图片字段(Image)的显示原理介绍试读版
SAP Fiori Elements 应用里图片字段(Image)的显示原理介绍试读版
17 0
|
3月前
|
中间件
SAP UI5 Tooling 实战:动手创建自己的 Custom UI5 Server Middleware 试读版
SAP UI5 Tooling 实战:动手创建自己的 Custom UI5 Server Middleware 试读版
19 0
SAP UI5 Tooling 实战:动手创建自己的 Custom UI5 Server Middleware 试读版
|
2月前
|
前端开发 搜索推荐 开发者
SAP UI5 sap.m.Column 控件的 minScreenWidth 属性介绍
SAP UI5 sap.m.Column 控件的 minScreenWidth 属性介绍
29 0