Skip to content

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

属性 ​

支持两个次级属性,分别用于自定义作用域和定义接口路由:

属性必填描述
routesY应用对外暴露的 REST APIs
scopesY应用支持的自定义作用域

举报邮箱:abuse@worktile.com