Exposer
exposer 定义应用对外暴露自定义 REST APIs 信息。
结构
结构定义如下:
yaml
exposer {}
├─ routes [] [Mandatory]
│ ├─ key (string) [Mandatory]
│ ├─ path (string) [Mandatory]
│ ├─ method (string) [Mandatory]
│ ├─ accept [] [Optional]
│ ├─ scopes [] [Mandatory]
│ └─ handler {} [Mandatory]
└─ scopes [] [Mandatory]
├─ name (string) [Mandatory]
├─ displayName (string) [Mandatory]
└─ description (string) [Optional]示例
简单配置示例:
yaml
exposer:
routes:
- key: get-employee-api
path: /employeeName
method: GET
handler:
function: employee-handler
accept:
- application/json
scopes:
- ncp:read:employee
scopes:
- name: ncp:read:employee
displayName: Read Employee Info
description: Read Employee Info属性
支持两个次级属性,分别用于自定义作用域和定义接口路由:
| 属性 | 必填 | 描述 |
|---|---|---|
routes | Y | 应用对外暴露的 REST APIs |
scopes | Y | 应用支持的自定义作用域 |